Re: T_PAAMAYIM_NEKUDOTAYIM

From: Date: Mon, 16 Dec 2002 18:53:39 +0000
Subject: Re: T_PAAMAYIM_NEKUDOTAYIM
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-92527@lists.php.net to get a copy of this message
> Hi, > > Tell me if this is the wrong list to ask or if this has been answered > somewhere else before. Thanks :) > > I am trying to make something like that: > > $myClassName = 'MyClass'; > return $myClassName::myMethod($param1, $param2); > > And I get : > > Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM > > I found a way to get around this by using: > > return eval(("return $myClassName:: myMethod('$param1', > '$param2');"); > > This works except when one of the parameters is an array. > > What is this ? > Is it a bug or a feature and will it change in ZE2 ? > Is there another way to get around this to let it accept arrays ? > Its neither, its a fact of the language, the following: $classname::method is illegal, you recieved a parse error to that effect. the best thing to do is:: call_user_func(array($className, 'method'), $param1, $param2); -Sterling > TIA, > > Bertrand Mansion > Mamasam > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.dev (#92527) next »