How to find an array from parent array

Posted by Me-and-Coding on Stack Overflow See other posts from Stack Overflow or by Me-and-Coding
Published on 2010-06-04T06:38:27Z Indexed on 2010/06/04 6:49 UTC
Read the original article Hit count: 252

Filed under:
|
|

Hi,

I am using below code to find an array inside parent array but it is not working that is retuning empty even though the specified key exits in the parent array.

$cards_parent = $feedData['BetradarLivescoreData']['Sport']['Category']['Tournament']['Match'];
$cards = array();

foreach($cards_parent as $key => $card)
{
    if ($key === 'Cards')
    {
        $cards[] = $cards_parent[$key];
        break;
    }
}

Do you know any array function that will search parent array for specified key and if found it will create an array starting from that key.

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about web-development