Use array_chunk
:
$pieces = array_chunk($array, ceil(count($array) / 2));
If you want them in separate variables (instead of a multi-dimensional array), use list
:
list($array1, $array2) = array_chunk($array, ceil(count($array) / 2));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…