note 14890 added to keyword.parent.php

From: Date: Mon, 20 Aug 2001 05:29:51 +0000
Subject: note 14890 added to keyword.parent.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-16905@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! http://www.php.net/manual/en/keyword.parent.php

« previous php.notes (#16905) next »