Skip to content

Instantly share code, notes, and snippets.

@kriswallsmith
Created October 10, 2009 13:02
Show Gist options
  • Save kriswallsmith/206830 to your computer and use it in GitHub Desktop.
Save kriswallsmith/206830 to your computer and use it in GitHub Desktop.
<?php
static protected function removeIncludePath($file)
{
$includePaths = explode(PATH_SEPARATOR, get_include_path());
foreach ($includePaths as $includePath)
{
// ignore relative or invalid include paths
if (0 === strpos($includePath, '.') || false === $includePath = realpath($includePath))
{
continue;
}
if (0 === strpos($file, $includePath.DIRECTORY_SEPARATOR))
{
return substr($file, strlen($includePath.DIRECTORY_SEPARATOR));
}
}
return $file;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment