<?phpini_set('display_errors','on');error_reporting(E_ALL);require_once'Zend/Loader/Autoloader.php';Zend_Loader_Autoloader::getInstance();classBase{publicfunction__construct(){Zend_Debug::dump("You are calling a constructor!");}publicfunction__destruct(){Zend_Debug::dump("You are calling a destructor!");}}$b=newBase();unset($b);/** * string 'You are calling a constructor!' (length=30) * string 'You are calling a destructor!' (length=29) */
<?phpini_set('display_errors','on');error_reporting(E_ALL);require_once'Zend/Loader/Autoloader.php';Zend_Loader_Autoloader::getInstance();classBase{protectedfunctiontest(){Zend_Debug::dump("test!");}protectedstaticfunctionstaticTest(){Zend_Debug::dump("static test!");}publicfunction__call($name,$params){Zend_Debug::dump("You are calling normal method {$name} with params:");Zend_Debug::dump($params);$this->{$name}();}publicfunction__callStatic($name,$params){Zend_Debug::dump("You are calling static method {$name} with params:");Zend_Debug::dump($params);self::{$name}();}}$b=newBase();$b->test();$b->test(1,2,3);Base::staticTest();Base::staticTest(1,2,3);/*string 'You are calling normal method test with params:' (length=47)array (size=0) emptystring 'test!' (length=5)string 'You are calling normal method test with params:' (length=47)array (size=3) 0 => int 1 1 => int 2 2 => int 3string 'test!' (length=5)string 'You are calling static method staticTest with params:' (length=53)array (size=0) emptystring 'static test!' (length=12)string 'You are calling static method staticTest with params:' (length=53)array (size=3) 0 => int 1 1 => int 2 2 => int 3string 'static test!' (length=12) */
<?phpini_set('display_errors','on');error_reporting(E_ALL);require_once'Zend/Loader/Autoloader.php';Zend_Loader_Autoloader::getInstance();classBase{publicfunction__get($name){Zend_Debug::dump("you are accessing {$name}");}publicfunction__set($name,$value){Zend_Debug::dump("you are assigning {$value} to {$name}");}publicfunction__isset($name){Zend_Debug::dump("you are judging {$name}");}publicfunction__unset($name){Zend_Debug::dump("you are unsetting {$name}");}}$b=newBase();// __set$b->age=20;// __get$b->age;// __issetisset($b->age);// __issetempty($b->age);// unsetunset($b->age);/*string 'you are assigning 20 to age' (length=27)string 'you are accessing age' (length=21)string 'you are judging age' (length=19)string 'you are judging age' (length=19)string 'you are unsetting age' (length=21) */