I need a function to return a relative path of the file , every where i run it.
for example this is my code in “loc.php” :
<?
echo whereiam();
?>
outputs in these directories should be:
public_html/loc.php : /
public_html/folder1/folder2/loc.php : ../../
Is there any built-in function in php for this use?
The closest thing you’re going to get is:
EDIT: As for the second part of your script, I would probably do something like count the number of ‘/’s -1 in $_SERVER[“SCRIPT_NAME”] and echo out that many ../’s? As far as I know there is no function that does something like this out of the box.