Skip to main content
gamedev.net
🔒 Locked 🤖 Godot

[web] [php] static vars?

Started by supagu 1 reply 400+ views
Original Post
supagu
supagu
i want to put a staticc var in my class, yet it complains that its not expected?!

class Engine
{
	static $basePath = 'hello?';



the error i get is:
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' 

any ideas why this could be?
demonkoryu
demonkoryu
Try
class Engine{    public static $basePath = 'hello?';}


or maybe

class Engine{    public static $basePath;}Engine::$basePath = 'hello?';

tstrimp
tstrimp
Also, make sure you're using a version of PHP that supports static. 5.0+ I think.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.