how to split the array in to two equal parts using php
From the documentation for array_slice, all you have to do is give array_slice
an offset and a length.
In your case:
$firsthalf = array_slice($original, 0, 1200);$secondhalf = array_slice($original, 1200);
In other words, this code is telling array_slice
:
take the first 1200 records;then, take all the records starting at index 1200;
Since index 1200 is item 1201, this should be what you need.