Guest User

Untitled

a guest
Jun 17th, 2014
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Replace getopt()
  5.  *
  6.  * @category    PHP
  7.  * @package     PHP_Compat
  8.  * @license     LGPL - http://www.gnu.org/licenses/lgpl.html
  9.  * @copyright   2004-2007 Aidan Lister <[email protected]>, Arpad Ray <[email protected]>
  10.  * @link        http://php.net/function.stream-resolve-include-path
  11.  * @version     $Revision$
  12.  * @since       PHP 5.2.0
  13.  */
  14. function php_compat_stream_resolve_include_path($filename)
  15. {
  16.     $paths = PATH_SEPARATOR == ':' ?
  17.         preg_split('#(?<!phar):#', get_include_path()) :
  18.         explode(PATH_SEPARATOR, get_include_path());
  19.     foreach ($paths as $prefix) {
  20.         $ds = substr($prefix, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR;
  21.         $file = $prefix . $ds . $filename;
  22.  
  23.         if (file_exists($file)) {
  24.             return $file;
  25.         }
  26.     }
  27.  
  28.     return false;
  29. }
  30.  
  31.  
  32. // Define
  33. if (!function_exists('getopt')) {
  34.     function stream_resolve_include_path($filename) {
  35.         return php_compat_stream_resolve_include_path($filename);
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment