May 30, 2013

Original script directory in PHP

Bjørn Kjos-Hanssen’s Question:

Magic constant __DIR__ is the directory of the current script, but what if I need the directory of the script that included or required it, I.e. the original script?

Like this

echo dirname($_SERVER['SCRIPT_NAME']);

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!