__autoload in PHP


/ Published in: PHP
Save to your folder(s)

bob.php and bob2.php are my 2 class files


Copy this code and paste it in your HTML
  1. <?php
  2. function __autoload($class_name) {
  3. require_once $class_name.".php";
  4. }
  5.  
  6. $bob = new bob();
  7. $bob2 = new bob2();
  8.  
  9. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.