> 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 > -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php