Home » » dirname

dirname

Written By 1 on Sunday, September 30, 2012 | 9:56 AM

string dirname ( string $path )

Returns parent directory's path

Given a string containing the path of a file or directory, this function will return the parent directory's path.


<?php
echo "1) " dirname("/etc/passwd") . PHP_EOL// 1) /etc
echo "2) " dirname("/etc/") . PHP_EOL// 2) / (or \ on Windows)
echo "3) " dirname("."); // 3) .
?>

5.0.0 dirname() is now binary safe 4.0.3 dirname() was fixed to be POSIX-compliant.


Lavorare con include()/require() e .._once PHP [OBIV].it

0 Comment:

Post a Comment