Tag Archives: slice

Two-Dimensional Array Slicing in PHP

Tested with PHP 5.3.1

The array_slice function in PHP is a handy way to copy a chunk of information from one array to second array. This is useful to examine or modify some interesting set of data without mucking about with your original set, or cutting down on the size and overhead of operations, because you’re running them against a more compact array.

The function works on two-dimensional arrays, but in an unexpected way. Read more »