having issues with defining a namespace for an abstract class.
Class looks like so:
helloworld.class.php:
namespace Kitten;
abstract class HelloWorld {
public static function hi()
{
echo 'hello';
}
}
index.php:
require_once helloworld.class.php;
Kitten::HelloWorld::hi();
The error I’m getting is: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
Any help or pointers in the right direction would be appreciated.
Thanks.
Namespaces are accessed with the backslash character
\Kitten\HelloWorld::hi();T_PAAMAYIM_NEKUDOTAYIMmeans double colon::, a Scope Resolution OperatorYour require statement is also incorrect. Wrap the file and path in quotes as follows: