I am new to php. I am trying to get relative path of my project, but not exactly as required.
I mean I have a directory structure like : '/opt/www/abc/myproj/folder1/folder2/myfile.php'
So in myfile.php I am trying to get path till my project ie., /opt/www/abc/myproj
I have tried differnt ways like using $_SERVER["DOCUMENT_ROOT"]
, dirname(__FILE__)
, basename(__FILE__)
etc.. but still no luck.
Could anyone please tell me how can I achieve above.