note 108931 added to reflectionmethod.invoke

From: Date: Wed, 06 Jun 2012 13:19:37 +0000
Subject: note 108931 added to reflectionmethod.invoke
Groups: php.notes 
Request: Send a blank email to php-notes+get-188418@lists.php.net to get a copy of this message
This method can be used to call a overwritten public method of a parent class on an child instance The following code will output "A": <?php class A { public function foo() { return __CLASS__; } } class B extends A { public function foo() { return __CLASS__; } } $b = new B(); $reflection = new ReflectionObject($b); $parentReflection = $reflection->getParentClass(); $parentFooReflection = $parentReflection->getMethod('foo'); $data = $parentFooReflection->invoke($b); echo $data; ?> ---- Server IP: 91.199.167.223 Probable Submitter: 95.97.52.42 ---- Manual Page -- http://www.php.net/manual/en/reflectionmethod.invoke.php Edit -- https://master.php.net/note/edit/108931 Del: integrated -- https://master.php.net/note/delete/108931/integrated Del: useless -- https://master.php.net/note/delete/108931/useless Del: bad code -- https://master.php.net/note/delete/108931/bad+code Del: spam -- https://master.php.net/note/delete/108931/spam Del: non-english -- https://master.php.net/note/delete/108931/non-english Del: in docs -- https://master.php.net/note/delete/108931/in+docs Del: other reasons-- https://master.php.net/note/delete/108931 Reject -- https://master.php.net/note/reject/108931 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188418) next »