3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array("a", "b", "c", "d", "e"); $len = count($input); $firsthalf = array_slice($input, 0, intval($len / 2)); $secondhalf = array_slice($input, intval($len / 2)); var_dump($firsthalf, $secondhalf);

preferences:
57.4 ms | 2754 KiB | 5 Q