Advertisement
fruffl

abstract class alias

Feb 13th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. <?PHP
  2.     NAMESPACE ILLI\Std\Spl;
  3.    
  4.     if(class_exists('root\foo')){ class_alias('root\foo', 'ILLI\Std\Spl\foo'); }
  5.     else{ class foo{ } }
  6.    
  7.     CLASS Test EXTENDS foo{ }
  8.  
  9. <?PHP
  10.     NAMESPACE root;
  11.  
  12.     //class foo { public function __construct() { var_dump(__CLASS__); } }
  13.  
  14.     $e = new \ILLI\Std\Spl\Test;
  15.     $f = 'ILLI\Std\Spl\foo';
  16.     var_dump($e instanceOf $f);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement