3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = "um dois três quatro cinco seis"; echo $str, "<br>\n"; echo trim($str), "<br>\n"; echo trim($str, ' '), "<br>\n"; echo preg_replace('/[ ]*/', '', $str), "\n\n"; class Teste { public function __construct() { /* */ } public static function __callStatic($function, $arguments){ if(method_exists(__CLASS__, $function)){ echo "teste fake __ constructor \n"; call_user_func_array( array(__CLASS__, $function), $arguments ); } else { echo "método não existe \n\n"; } } public function teste(){ echo "teste __ method\n"; } } Teste::teste();
based on UTXNv
Output for 7.0.0 - 7.1.0
um dois três quatro cinco seis<br> um dois três quatro cinco seis<br> um dois três quatro cinco seis<br> umdoistrêsquatrocincoseis Fatal error: Uncaught Error: Non-static method Teste::teste() cannot be called statically in /in/7qor2:33 Stack trace: #0 {main} thrown in /in/7qor2 on line 33
Process exited with code 255.
Output for 5.2.14 - 5.2.17, 5.3.3 - 5.6.28
um dois três quatro cinco seis<br> um dois três quatro cinco seis<br> um dois três quatro cinco seis<br> umdoistrêsquatrocincoseis Fatal error: Non-static method Teste::teste() cannot be called statically in /in/7qor2 on line 33
Process exited with code 255.
Output for 5.0.0 - 5.2.13, 5.3.0 - 5.3.2
Strict Standards: Redefining already defined constructor for class Teste in /in/7qor2 on line 27 um dois três quatro cinco seis<br> um dois três quatro cinco seis<br> um dois três quatro cinco seis<br> umdoistrêsquatrocincoseis Fatal error: Non-static method Teste::teste() cannot be called statically in /in/7qor2 on line 33
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/7qor2 on line 11
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_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/7qor2 on line 11
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/7qor2 on line 11
Process exited with code 255.