3v4l.org

run code in 300+ PHP versions simultaneously
<?php function implode_wrapper($glue , $pieces) { return (version_compare(PHP_VERSION, '7.3.99', '>')) ? implode($glue, $pieces) : implode($pieces, $glue); } function test_func($a, $b, &$cRef) { $args = func_get_args(); echo __FUNCTION__."(".implode(",",$args) . ")\n"; $cRef+=$a; } $testdata = array( array(1,1), array(2,2), array(3,3), array(4,4) ); if(defined("E_STRICT")) ini_set("error_reporting", ini_get("error_reporting") | E_STRICT); $refTest = 10; foreach($testdata as $test) { $args = array(); foreach($test as $t) $args[] = &$t; $args[] = &$refTest; call_user_func_array("test_func", $args); }
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.3.33, 7.4.0 - 7.4.25, 7.4.27 - 7.4.30, 8.0.0 - 8.0.12, 8.0.14 - 8.0.22, 8.1.0 - 8.1.9
test_func(1,1,10) test_func(2,2,11) test_func(3,3,13) test_func(4,4,16)
Output for 8.0.13
Fatal error: Uncaught TypeError: Unsupported operand types: string | int in /in/NJN2u:25 Stack trace: #0 {main} thrown in /in/NJN2u on line 25
Process exited with code 255.
Output for 7.3.32, 7.4.26
Warning: A non-numeric value encountered in /in/NJN2u on line 25 test_func(1,1,10) test_func(2,2,11) test_func(3,3,13) test_func(4,4,16)

preferences:
68.09 ms | 411 KiB | 5 Q