3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test_assert($string, $arguments = array()) { // Make sure we don't pass in an empty string. assert('$string !== \'\' && (empty($arguments) || strtr($string, $arguments) !== \'\'))'); // Make sure we don't translate unnecessarily. assert('empty($arguments) || strtr($string, $arguments) != implode($arguments)'); } test_assert('@test', ['@test' => 'test']);
Output for 7.2.0
Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/buOGu on line 5 Fatal error: Uncaught ParseError: syntax error, unexpected ')', expecting ';' in /in/buOGu(5) : assert code:1 Stack trace: #0 /in/buOGu(5): assert('$string !== '' ...') #1 /in/buOGu(10): test_assert('@test', Array) #2 {main} Next Error: Failure evaluating code: $string !== '' && (empty($arguments) || strtr($string, $arguments) !== '')) in /in/buOGu:5 Stack trace: #0 /in/buOGu(5): assert('$string !== '' ...') #1 /in/buOGu(10): test_assert('@test', Array) #2 {main} thrown in /in/buOGu on line 5
Process exited with code 255.
Output for 7.1.0 - 7.1.10
Fatal error: Uncaught ParseError: syntax error, unexpected ')', expecting ';' in /in/buOGu(5) : assert code:1 Stack trace: #0 /in/buOGu(5): assert('$string !== '' ...') #1 /in/buOGu(10): test_assert('@test', Array) #2 {main} Next Error: Failure evaluating code: $string !== '' && (empty($arguments) || strtr($string, $arguments) !== '')) in /in/buOGu:5 Stack trace: #0 /in/buOGu(5): assert('$string !== '' ...') #1 /in/buOGu(10): test_assert('@test', Array) #2 {main} thrown in /in/buOGu on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Parse error: syntax error, unexpected ')', expecting ';' in /in/buOGu(5) : assert code on line 1 Catchable fatal error: assert(): Failure evaluating code: $string !== '' && (empty($arguments) || strtr($string, $arguments) !== '')) in /in/buOGu on line 5
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Parse error: syntax error, unexpected ')' in /in/buOGu(5) : assert code on line 1 Catchable fatal error: assert(): Failure evaluating code: $string !== '' && (empty($arguments) || strtr($string, $arguments) !== '')) in /in/buOGu on line 5
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/buOGu on line 10
Process exited with code 255.