PHP Classes

File: demo/autoloader.php

Recommend this page to a friend!
  Classes of Ordland Euroboros   PHP Collections Framework   demo/autoloader.php   Download  
File: demo/autoloader.php
Role: Auxiliary script
Content type: text/plain
Description: The Autoload File
Class: PHP Collections Framework
Manipulate collections of objects like Java and C#
Author: By
Last change:
Date: 11 years ago
Size: 340 bytes
 

Contents

Class file image Download
<?php

function __autoload($class) {
   
$stack = explode('\\', $class);
   
$class = array_pop($stack);
   
$namespace = array_pop($stack);
   
$file = strtolower("../{$namespace}/{$class}.php");
    if(
file_exists($file)) include($file);
    else throw new \
Resource\Exception\ClassNotFoundException("Cannot load class {$class}");
}
   
?>