Re: PHP arguments getting lost in call!?

From: Date: Sun, 13 Feb 2011 08:49:38 +0000
Subject: Re: PHP arguments getting lost in call!?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-311265@lists.php.net to get a copy of this message
On 02/13/2011 02:06 PM, Florin Jurcovici wrote: > Hi. > > The entry point in my php app is a file containing something like: > > require_once("Disptacher.php"); > > ... > > Dispatcher:dispatch($arguments); > > ... > > > The file Dispatcher.php is located in the same folder as the file > containing the above code, and contains the following: > > class Dispatcher > { > public static function dispatch($arguments) > { > ... > } > } > > > For some reason, although before the call to Dispatcher::dispatch() > the variable $arguments is set, and contains what it is supposed to > contain, inside Dispatcher:dispatch() $arguments is always empty. How > come? What am I doing wrong? How can I call a static method and pass > it arguments? > > br, > > flj > You are probably misspelling something, just tried out the code like this: t.php: require_once "t1.php"; $args = array('f', 'g', 'h'); t1::fn($args); t1.php: class t1 { public static function fn($a) { var_dump($a); } } And this gives me: array(3) { [0]=> string(1) "f" [1]=> string(1) "g" [2]=> string(1) "h" } which is as expected -- Regards, Nilesh Govindarajan Facebook: http://www.facebook.com/nilesh.gr Twitter: http://twitter.com/_linuxgeek_ Website: http://www.itech7.com

« previous php.general (#311265) next »