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_autoload2.php
08spl_autoload2.php
<?php /*** 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_loader'); echo "<hr/>"; /**lib1_prva.php**/ $obj=new \lib1\Prva; echo $obj->sv; $obj->metoda(); echo \lib1\K; \lib1\fja(); //echo $var; javlja gresku /**lib1_druga.php**/ $obj=new \lib1\Druga; echo $obj->sv; $obj->metoda(); ?>
Reload page
Preview
W3C validation
Edit Code