3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class T { public $a = $this->string_to_ascii("Perkele") function string_to_ascii($string) { $ascii = NULL; for ($i = 0; $i < strlen($string); $i++) { $ascii += ord($string[$i]); } return($ascii); } } $t = new T(); var_dump($t->a);
based on KSrTU
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected 'function' (T_FUNCTION), expecting ',' or ';' in /in/8HUD3 on line 6
Process exited with code 255.
Output for 5.4.11 - 5.6.17
Parse error: syntax error, unexpected '$this' (T_VARIABLE) in /in/8HUD3 on line 4
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/8HUD3 on line 4
Process exited with code 255.