note 97276 added to reflectionfunctionabstract.getnumberofparameters

From: Date: Sun, 11 Apr 2010 22:42:24 +0000
Subject: note 97276 added to reflectionfunctionabstract.getnumberofparameters
Groups: php.notes 
Request: Send a blank email to php-notes+get-168142@lists.php.net to get a copy of this message
Working on a new MVC Application Framework i use this method to check how many arguments are required before calling the sub method! Example <?php $this->method_args_count = $this->CReflection ->getMethod($Route->getMethod()) ->getNumberOfParameters(); //Maybe be 5 but if uri is /controller/method/single_param/ we only of 1 $this->params = $Route->getParams(); //0 in some cases if($this->method_args_count > count($this->params)) { $this->difference = ($this->method_args_count - count($this->params)); for($i=0;$i<=$this->difference;$i++) { $this->params[] = false; } } //Call the method with correct amount of params // but as false for params that have not been passed! call_user_func_array(array(new $this->obj,$Route->getMethod()),$this->params); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 94.171.94.153 ---- Manual Page -- http://www.php.net/manual/en/reflectionfunctionabstract.getnumberofparameters.php Edit -- https://master.php.net/note/edit/97276 Del: integrated -- https://master.php.net/note/delete/97276/integrated Del: useless -- https://master.php.net/note/delete/97276/useless Del: bad code -- https://master.php.net/note/delete/97276/bad+code Del: spam -- https://master.php.net/note/delete/97276/spam Del: non-english -- https://master.php.net/note/delete/97276/non-english Del: in docs -- https://master.php.net/note/delete/97276/in+docs Del: other reasons-- https://master.php.net/note/delete/97276 Reject -- https://master.php.net/note/reject/97276 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168142) next »