Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
backend
php
oop
namespaces
08spl_autoload.php
08spl_autoload.php
<?php namespace lib1; /*** class Loader ***/ function lib1_loader($class_name) { $filename=strtolower($class_name).'.php'; $filename=str_replace("\\","_",$filename); $put='./lib1/'.$filename; if(is_readable($put)) {include $put; echo "<br/><b>$put</b><br/>";} else echo "<br/>Greska: <b>$put</b><br/>"; } spl_autoload_register('\lib1\lib1_loader'); echo "<hr/>"; /**lib1**/ $obj=new Prva; echo $obj->sv; $obj->metoda(); echo K; fja(); //echo $var; javlja gresku /**lib1**/ $obj=new Druga; echo $obj->sv; $obj->metoda(); ?>
Reload page
Preview
W3C validation
Edit Code