Syntax error, unexpected T PAAMAYIM NEKUDOTAYIM

From Php

Jump to: navigation, search

This error has to do with the scope operator (::). (Wikipedia has an [[http://en.wikipedia.org/wiki/Paamayim_Nekudotayim explanation of the name.)

You can get this error if you are missing a class name.

WRONG

 $foo = FooClass;
 $foo::bar();

RIGHT

 FooClass::bar();


Why?

 FooClass::bar(); 

is a static call, not to be used with a var ( or object ) in the $foo var.

So calling a static call, using minor object features will be done with: FooClass::bar(); and using more object stuff, dynamically, ( recognisable by $this->barbar(); in a class function ) will be like:

 $foo = new FooClass;
 $foo->initate();
 $foo->doSomething();
 $foo->finish();
Personal tools