3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = ['a' => 1, 'b' => 2, 'c' => 3]; $b = [4,5]; print_r($a); print_r($b); $r= array_splice($a, 2, 2, $b); $r1 = array_slice($a, 2,1,1); print_r($r); print_r($r1);
Output for 5.6.0 - 5.6.31, 5.6.34 - 5.6.38, 5.6.40, 7.0.0 - 7.0.30, 7.0.32 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.3, 7.2.8 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0, 8.1.28, 8.2.15 - 8.2.18, 8.3.2 - 8.3.4, 8.3.6
Array ( [a] => 1 [b] => 2 [c] => 3 ) Array ( [0] => 4 [1] => 5 ) Array ( [c] => 3 ) Array ( [0] => 4 )
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Array ( [a] => 1 [b] => 2 [c] => 3 ) Array ( [0] => 4 [1] => 5 ) Array ( [c] => 3 ) Array ( [0] => 4 )
Output for 5.6.32 - 5.6.33, 5.6.39, 7.0.31, 7.2.4 - 7.2.7

Process exited with code 137.

preferences:
142.86 ms | 402 KiB | 164 Q