3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_assert($string, $arguments = array()) { // Make sure we don't pass in an empty string. assert('$string !== \'\' && (empty($arguments) || strtr($string, $arguments) !== \'\')', 'empty fail:' . $string); // Make sure we don't translate unnecessarily. assert('empty($arguments) || strtr($string, $arguments) != implode($arguments)', 'unnecesary fail: ' . $string); } test_assert('@test1', ['@test1' => 'test']); test_assert('@test2', ['@test2' => 'test']); test_assert('@test3 foo', ['@test3' => 'test3', '@test_not_used' => 'test']); test_assert('@test3 foo', ['@test3' => 'test3', '@test_not_used' => 'test']);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/AB2tL on line 5 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/AB2tL on line 7 Warning: assert(): unnecesary fail: @test1: "empty($arguments) || strtr($string, $arguments) != implode($arguments)" failed in /in/AB2tL on line 7 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/AB2tL on line 5 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/AB2tL on line 7 Warning: assert(): unnecesary fail: @test2: "empty($arguments) || strtr($string, $arguments) != implode($arguments)" failed in /in/AB2tL on line 7 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/AB2tL on line 5 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/AB2tL on line 7 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/AB2tL on line 5 Deprecated: assert(): Calling assert() with a string argument is deprecated in /in/AB2tL on line 7
Output for 5.4.8 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.3.32 - 7.3.33
Warning: assert(): unnecesary fail: @test1: "empty($arguments) || strtr($string, $arguments) != implode($arguments)" failed in /in/AB2tL on line 7 Warning: assert(): unnecesary fail: @test2: "empty($arguments) || strtr($string, $arguments) != implode($arguments)" failed in /in/AB2tL on line 7

preferences:
196.8 ms | 403 KiB | 220 Q