Archive for the ‘php’ Category

What does dirname(__FILE__) and basename(dirname(__FILE__)) do?

Was helping a friend fix his php script today. He was not too sure about what “dirname(__FILE__)” did. dirname() is a PHP function which returns the directory name of a file. For example if file abc.txt was in “/tmp/abc.txt” then the dirname() function would return “/tmp” . Example Usage; <?php $file = “/tmp/abc.txt”; $path = [...]

© 2008-2012 The Danesh Project
Powered by Wordpress and made by Guerrilla. Hosted at ServerFreak