Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. <?php
  2. /*
  3.  * Charge une classe à son instantiation
  4.  * @param string $class_name | Nom de la classe à charger
  5.  * @return                   | Aucune valeur n'est retournée.
  6.  */
  7. function __autoload( $class_name )
  8. {
  9.     $file_infos = array( 'classes' => array( '.class.php', '.helper.class.php' ) );
  10.                    
  11.     foreach( $file_infos as $dir => $array_ext )
  12.     {
  13.         foreach( $array_ext as $key => $ext )
  14.         {
  15.             if( is_file( $dir.'/'.$class_name.$ext ) )
  16.             {
  17.                 require_once( $dir.'/'.$class_name.$ext );
  18.             }
  19.         }
  20.     }
  21. }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement