PHP 4.4.9 throws ‘Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’’

Today, my website decided suddenly not to work and reported a syntax error however I had not made any changes to it. It gave me an error message

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'

… I looked at all the braces and keywords and they all checked out fine. I looked at phpinfo() and found my PHP5.* had been downgraded to PHP4.* however this did not explain why the script did not work. I wrote this test class

<?php
class TestClass
{
	static $instance;
}
?>

and to my surprise it threw the same error message as my website.

Here is the solution: PHP4.* does support the ‘static’ keyword however it supports it in the scope of a function and not in a ‘class’, example

<?php
function testFunction()
{
	static $instance = 0;
	echo "Instance value " . $instance;
	$instance++
}
?>

So, only way to fix this is to upgrade to PHP5 which I did.