I Hope this will help you.
echo getcwd().'<br>'; // getcwd() will return current working directory
echo dirname(getcwd(),1).'<br>';
echo dirname(getcwd(),2).'<br>';
echo dirname(getcwd(),3).'<br>';
Output :
C:wamp64wwwpublic_htmlstep
C:wamp64wwwpublic_html
C:wamp64www
C:wamp64