PHP : flatten array - fastest way? -


is there fast way flatten array , select subkeys ('key'&'value' in case) without running foreach loop, or foreach fastest way?

array (     [0] => array         (             [key] => string             [value] => simple string             [cas] => 0         )      [1] => array         (             [key] => int             [value] => 99             [cas] => 0         )      [2] => array         (             [key] => array             [value] => array                 (                     [0] => 11                     [1] => 12                 )              [cas] => 0         )  ) 

to:

array (     [int] => 99     [string] => simple string     [array] => array         (             [0] => 11             [1] => 12         ) ) 

give shot:

$ret = array(); while ($el = each($array)) {     $ret[$el['value']['key']] = $el['value']['value']; } 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -