3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class TestData { static $emptyValue = "null"; static $trueValue = "ok"; static $falseValue = "nok"; static $trueArray = array(1,'1',true,'true','yes' ); static $falseArray = array(0,'0',false,'false','no' ); static function testData($data) { if( in_array($data, self::$trueArray, true) ) { return self::$trueValue; } elseif( in_array($data, self::$falseArray, true) ) { return self::$falseValue; } else { return self::$emptyValue; } } } var_dump(TestData::testData(false)); var_dump(TestData::testData(true)); var_dump(TestData::testData('true')); var_dump(TestData::testData('false')); var_dump(TestData::testData('yes')); var_dump(TestData::testData('no')); var_dump(TestData::testData('')); var_dump(TestData::testData(1)); var_dump(TestData::testData(0));
based on 90tc0
Output for 5.0.0 - 5.4.34
Fatal error: Constructor TestData::testData() cannot be static in /in/pYUja on line 17
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/pYUja on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/pYUja on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/pYUja on line 3
Process exited with code 255.