T_PAAMAYIM_NEKUDOTAYIM PHP error

Ok so i've hit this nasty php error T_PAAMAYIM_NEKUDOTAYIM that sounded like a language from another planet for me (found out that it's Hebrew for "missing double dots")

The problem is that with static class functions you can't do dynamic loading (or at least it didn't work for me)
So while this

  1. $module = $_GET['module']
  2. $stuff = new $module();
  3. $stuff->data;

works, you can't do
$module::data()
even if the name of the module is the name of the class.

Comments

try this way

call_user_func(array($module, 'data'));

"T_PAAMAYIM_NEKUDOTAYIM" means double colon in Hebrew.
well "Zend" are Israeli guys...

Got same error did you find the solution

None, it seems you can't do static calls.

Hi!
I got T_PAAMAYIM_NEKUDOTAYIM error by typing _$REQUEST instead of the correct name! Check your spelling :-)

With PHP 5.3 this is solved, and you can do "dynamic" static calls like in

$var = $classname::$functionname();

Workaround before PHP 5.3 would be eval('$var = '.$classname.'::'.$functionname.'();');

I'm currenly using PHP 5.3.5 and I have just got the same meaningless error. It might have been resolved in some aspects but it still lives.
As far as I understand, this error is shown when internal error-checking mechanizm cant decide on the error because I had the same error many times in many diifferent situations. The last occurence was on an recursive data access to orginize arrays dynamicly. I am not sure if it is really a problem.
I had it in a code like this

$x['a']['a'] = "a";
$x['a']['b'] = "b";
$x['a']['c'] = "c";

$x['b']['a'] = "d";
$x['b']['b'] = "e";
$x['b']['c'] = "f";
......
$a = &$x['a]; // to access without copying
$a works fine, but when I tried to add an element to point to another element in $x, but not in $x['a'], T_PAAMAYIM_NEKUDOTAYIM happened

eg;
$a['b'] = &$x['b']['b'];

T_PAAMAYIM_NEKUDOTAYIM

Nice explanation.Well we actually learned a lot from everyday

Pages

Add new comment