note 14890 deleted from keyword.parent by jimw

From: Date: Tue, 18 Dec 2001 23:00:37 +0000
Subject: note 14890 deleted from keyword.parent by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23291@lists.php.net to get a copy of this message
There is another tricky thing in using this: There seems to be no way to call another parent function out of a parent function! Following code: <?php class test { function test1(){ echo "parent:test1<br>"; } function test2(){ echo "parent:test2<br>"; $this->test1(); } } class sub extends test { function test1(){ echo "sub:test1<br>"; } function test2(){ echo "sub:test2<br>"; parent::test2(); } } $a = new sub(); $a->test2(); ?> returns: sub:test2 parent:test2 sub:test1 And you cannot call parent::function() out of itself!

« previous php.notes (#23291) next »