3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array(); $array2 = array("1", "2", "3", "4"); $result = array_slice( array_merge( array_slice( $array, 0, 2), array_slice( $array2, 0, 2)), 0, 2); print_r( $result);
based on Jofap
Output for 4.3.0 - 7.1.0
Array ( [0] => 1 [1] => 2 )