Very late. But I think that it will be useful for those who have landed here after the search.
I changed the code a little created by supajason Since the provided code did not return a consistent result: Mostly because of the nomenclature used.
I also added some functionality.
Hope this is helpful!
<?php define('ROOT', str_replace('\\', '/', getcwd()).'/');
Alex hakkenberg
source share