Here i have create the 3 php files .
MyClass1.php
<?php
class MyClass1 {
public $nm="brij";
}
?>
MyClass2.php
<?php
class MyClass2 {
public $nm="brij2";
}
?>
Test.php
<?php
spl_autoload_register(function ($class_name) {
include $class_name . '.php';
});
$obj = new MyClass1();
$obj2 = new MyClass2();
echo $obj->nm;
echo $obj2->nm;
?>
No comments:
Post a Comment