note 16448 rejected from keyword.parent by zak

From: Date: Wed, 31 Oct 2001 04:57:40 +0000
Subject: note 16448 rejected from keyword.parent by zak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19692@lists.php.net to get a copy of this message
I've been having problems with '$par = get_parent_class($this);' - get_parent_class($this) seems to always return the parent class of outermost class definition - for instance: class A { function A($v1, $v2) { echo "A\n"; } } class B extends A { function B($v1, $v2) { $par = get_parent_class($this); echo $par."\n"; $this->$par($v1, $v2); } } class C extends B { function C($v1, $v2) { $par = get_parent_class($this); echo $par."\n"; $this->$par($v1, $v2); } } $test = new C("xxx", "yyy"); causes the following infinite output: B B B B B B B (You don't actually see this output because the browser will not display the page due to the looping...) Terry

« previous php.notes (#19692) next »