MemoryRefresh!

Features / Autoload     Autoload



Questions Answers 0%

Pages   0 from 91
Questions   0 from 142

Reset


Autoload facility allows to load classes on-demand.
<?php function __autoload($class) { // --- Look Here --- // require_once str_replace("_", "/", $class); } $obj = new Article_Model(); The Standard PHP Library (SPL) offer a solution when working with different classes and libraries.
<?php //Register an autoload function function myAutoLoader($className) { include("classes/$className.php"); } spl_autoload_register("myAutoLoader"); // --- Look Here --- // //Register another autoload function function myOtherAutoLoader($className) { include("include/$className.php"); } spl_autoload_register("myOtherAutoLoader"); // --- Look Here --- // $obj = new MyClass1(); $obj2 = new MyClass2();
1) Which Php 5 feature help you with class loading?





2) Can you use multiple autoloading systems?







Autoload facility allows to load classes on-demand.
<?php function __autoload($class) { // --- Look Here --- // require_once str_replace("_", "/", $class); } $obj = new Article_Model(); The Standard PHP Library (SPL) offer a solution when working with different classes and libraries.
<?php //Register an autoload function function myAutoLoader($className) { include("classes/$className.php"); } spl_autoload_register("myAutoLoader"); // --- Look Here --- // //Register another autoload function function myOtherAutoLoader($className) { include("include/$className.php"); } spl_autoload_register("myOtherAutoLoader"); // --- Look Here --- // $obj = new MyClass1(); $obj2 = new MyClass2();

References









Programming

Php
   
Regex
   
MySQL
   
Css
   
jQuery
   
Git
   


References