Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

autoloader php

Example #1 Autoload example

This example attempts to load the classes MyClass1 and MyClass2 from the files MyClass1.php and MyClass2.php respectively.
<?php
spl_autoload_register(function ($class_name) {
    include $class_name . '.php';
});

$obj  = new MyClass1();
$obj2 = new MyClass2(); 
?>

Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #autoloader #php
ADD COMMENT
Topic
Name
5+7 =