summaryrefslogtreecommitdiff
path: root/ext/spl/examples/autoload.inc
diff options
context:
space:
mode:
authorPeter Kokot <peterkokot@gmail.com>2018-09-26 15:35:38 +0200
committerPeter Kokot <peterkokot@gmail.com>2018-09-29 09:29:32 +0200
commit80c6ba26e3fe83174a0e7dce367d8a39aa093ae1 (patch)
tree39e2cf0bdaf194d175f9b8c9d72a389e5db7009c /ext/spl/examples/autoload.inc
parentab60b799128d5a99e7b8a1210155a4f63b3d81c7 (diff)
downloadphp-git-80c6ba26e3fe83174a0e7dce367d8a39aa093ae1.tar.gz
Remove and refactor ext/spl/examples
- Test file from ext/spl/examples has been moved to ext/spl/tests - Other custom SPL examples and implementations were removed in favor of the PHP manual.
Diffstat (limited to 'ext/spl/examples/autoload.inc')
-rw-r--r--ext/spl/examples/autoload.inc50
1 files changed, 0 insertions, 50 deletions
diff --git a/ext/spl/examples/autoload.inc b/ext/spl/examples/autoload.inc
deleted file mode 100644
index 2ccd0d1be8..0000000000
--- a/ext/spl/examples/autoload.inc
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-/** @file autoload.inc
- * @ingroup Examples
- * @brief function __autoload
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** \internal
- * Tries to load class $classname from directory $dir.
- */
-function __load_class($classname, $dir)
-{
- $file = $dir . '/' . $classname . '.inc';
- if (file_exists($file))
- {
- require_once($file);
- return true;
- }
- return false;
-}
-
-/**
- * @brief Class loader for SPL example classes
- * @author Marcus Boerger
- * @version 1.0
- *
- * Loads classes automatically from include_path as given by ini or from
- * current directory of script or include file.
- */
-function __autoload($classname) {
- $classname = strtolower($classname);
- $inc = split(':', ini_get('include_path'));
- $inc[] = '.';
- $inc[] = dirname($_SERVER['PATH_TRANSLATED']);
- foreach($inc as $dir)
- {
- if (__load_class($classname, $dir))
- {
- fprintf(STDERR, 'Loading class('.$classname.")\n");
- return;
- }
- }
- fprintf(STDERR, 'Class not found ('.$classname.")\n");
-}
-
-?> \ No newline at end of file