note 101529 added to reflectionclass.getmethod

From: Date: Wed, 22 Dec 2010 20:58:14 +0000
Subject: note 101529 added to reflectionclass.getmethod
Groups: php.notes 
Request: Send a blank email to php-notes+get-175145@lists.php.net to get a copy of this message
If you ever need to get the type hint of a parameter in a method use this. <?php //Target our class $reflector = new ReflectionClass('MyClass'); //Get the parameters of a method $parameters = $reflector->getMethod('FireCannon')->getParameters(); //Loop through each parameter and get the type foreach($parameters as $param) { //Before you call getClass() that class must be defined! echo $param->getClass()->name; } ?> ---- Server IP: 192.41.42.26 Probable Submitter: 216.201.124.166 ---- Manual Page -- http://www.php.net/manual/en/reflectionclass.getmethod.php Edit -- https://master.php.net/note/edit/101529 Del: integrated -- https://master.php.net/note/delete/101529/integrated Del: useless -- https://master.php.net/note/delete/101529/useless Del: bad code -- https://master.php.net/note/delete/101529/bad+code Del: spam -- https://master.php.net/note/delete/101529/spam Del: non-english -- https://master.php.net/note/delete/101529/non-english Del: in docs -- https://master.php.net/note/delete/101529/in+docs Del: other reasons-- https://master.php.net/note/delete/101529 Reject -- https://master.php.net/note/reject/101529 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#175145) next »