Skip to content

Instantly share code, notes, and snippets.

@ddmills
Last active January 14, 2016 16:31
Show Gist options
  • Save ddmills/5e1ea8008b6ff72d7ffc to your computer and use it in GitHub Desktop.
Save ddmills/5e1ea8008b6ff72d7ffc to your computer and use it in GitHub Desktop.
Relative Path to Root
<?php
/* get a relative path to the sites root */
$root = preg_replace(':/[^/]+:', '../', dirname($_SERVER['SCRIPT_NAME']));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment