3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $arr=[1,2,3]; var_dump(array_slice($arr, '2'));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught TypeError: array_slice(): Argument #2 ($offset) must be of type int, string given in /in/doghu:5 Stack trace: #0 /in/doghu(5): array_slice(Array, '2') #1 {main} thrown in /in/doghu on line 5
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: array_slice() expects parameter 2 to be int, string given in /in/doghu:5 Stack trace: #0 /in/doghu(5): array_slice(Array, '2') #1 {main} thrown in /in/doghu on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.31, 7.1.0 - 7.1.23, 7.2.0 - 7.2.33
Fatal error: Uncaught TypeError: array_slice() expects parameter 2 to be integer, string given in /in/doghu:5 Stack trace: #0 /in/doghu(5): array_slice(Array, '2') #1 {main} thrown in /in/doghu on line 5
Process exited with code 255.
Output for 5.6.38
Warning: Unsupported declare 'strict_types' in /in/doghu on line 1 array(1) { [0]=> int(3) }

preferences:
90.04 ms | 1661 KiB | 4 Q