array_chunk'ing a multi-dimensional array in PHP -
i have multi-dimensional array , looking split every 10 elements.
array_chunk
appeared solution, can't find suggests supports multi-dimensional arrays.
is possible using php 5.3?
this sample of current array:
array ( [0] => cart object ( [cartid:protected] => 4337032 [userid:protected] => 271561 [orderid:protected] => 1042104 ) [1] => cart object ( [cartid:protected] => 4337032 [userid:protected] => 271561 [orderid:protected] => 1042104 ) ... , on ... )
what i'm looking for:
array ( [0] => array ( [0] => cart object ( [cartid:protected] => 4337032 [userid:protected] => 271561 [orderid:protected] => 1042104 ) [1] => cart object ( [cartid:protected] => 4337032 [userid:protected] => 271561 [orderid:protected] => 1042104 ) [1] => // next 10... )
$carts_to_page = array_chunk($carts, 10);
Comments
Post a Comment