I'm willing to ask a question is possible to get the path of the file where the code is running simply inserting the filename? Does such a function exist?
Example
$filename = "file.php";
$file_path = pathfinder_function($filename);
echo $file_path;
And I do get something similar to this
all/file/path/file.php
also somethig similar for URLs.