I have been having an issue getting values out of an array that is formatted like so:
array(
[key]=>array(
[0]=>value
[1]=>value
[2]=>value)
[key]=>array(
[0]=>value
[1]=>value))
I am using a queue to run through each key as the queue item and process the information. so to create the queue item I have tried this:
while ($array = $result->fetchAssoc())
{
$queue->createItem($array);
}
this fails to create any items so I have used this method instead
if ($array != 0 || $array != NULL) {
foreach ($array as $row) {
$queue->createItem($row);
}
}
Once the queue item is created the queue calls a function passing the queue $item and here is where I have problems as I can successfully get all the values of the second level array but I can not access the Key of the first level.
function work_function($item){
foreach($item as $row=>$job){
//do something
}
}
In my function I have tried:
//1
$arrayKEY= $item;
//2
foreach($item as $row){
$arrayKEY= $row;
}
I just cannot get the values I need. What am I doing wrong/can I do to accomplish this?
Thanks
$queueobject is, specifically.