Adsense 728 * 15

Search

Custom Search

use of dirname(__FILE__) in php



PHP beginners who started learning php confuse when to use dirname(__FILE__) in their php script.



So first of all learn what dirname(__FILE__) do.


so let's create a small php script

<?php




echo dirname(__FILE__);


?>


Output-     /var/www/dev       (output differs in your case as directory structure is different)


what does this script do it will print the path where your file save. It's very useful when you require a file.

No comments:

Post a Comment