im trying to display a specific chunk of an array where an element is located.
for example, lets say this is my array
Array
(
[0] => Array
(
[1] => a
[2] => b
[3] => c
[4] => d
[5] => e
)
[1] => Array
(
[6] => f
[7] => g
[8] => h
[9] => i
[10] => j
)
)
how do i search the array for the 10th key for example, and choose only the chunk its located in?
EDIT
thanks for the answers, however i didnt need a function so i came up with this, simple solution, i think:
$temp1 = array_chunk($cart_items, 5,true);
foreach ($temp1 as $key => $value) {
foreach ($value as $key2 => $value2) {
if($key2 == $itemid){
$c_id = $key;
}
else{
}
}
}
array_search()? php.net/manual/en/function.array-search.php