Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php dirname

// dirname ( string $path [, int $levels = 1 ] ) : string

<?php
echo dirname("/etc/passwd") . PHP_EOL;
echo dirname("/etc/") . PHP_EOL;
echo dirname(".") . PHP_EOL;
echo dirname("C:") . PHP_EOL;
echo dirname("/usr/local/lib", 2);

// Above example outputs:

/*
	"/etc"
	"/" (or "" on Windows)
	"."
	"C:"
	"/usr"
*/
Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #php #dirname
ADD COMMENT
Topic
Name
8+1 =