Is it possible to guess the absolute path of a relative path that I have specified for loading a XML file? This is my coding:
$strXML = __DIR__ . "/../xml/file.xml";
$xmlFile = simplexml_load_file($strXML);
$strPath = fullPathFunction($xmlFile); //Desired function

realpath()?/home/user/public_htmlbut my expected result is/home/user/public_html/xml/file.xml$strXML = __DIR__ . '/../xml/file.xml';assuming the path is relative to your.phpscript__DIR__is geting the path to my.phpfile, so it gets/home/user/public_html/phpbut my.xmlfile is inside/home/user/public_html/xmldirectory/../xml/file.xmlis appended to__DIR__. If__DIR__is/home/user/public_html/php, then/home/user/public_html/php/../xml/file.xmlwill resolve (viarealpath()) to/home/user/public_html/xml/file.xml. If you're now using__DIR__, please update the code in your question