Share on Google+Share on Google+

PHP dirname() Function, PHP dirname(), dirname php

The example of PHP dirname() Function. Learn how to get the directory name of a file. It gives the name (full path) of the directory in which the file is present.

In this example we will explain the use of dirname() function in PHP. The dirname() function is used to get the full directory path name of the file. The following code snippet shows the correct use of dirname function.

Syntax of PHP dirmane()Function

String dirname ($path )

It returns the directory name of the specified file.

Code dirmane()Function in PHP



echo $dir1;



echo $dir2;






Posted on: September 21, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null