PHP搜索子阵列与特定键

问题描述:

我需要导航此阵列PHP搜索子阵列与特定键

Array 
(
    [0] => Array 
     (
      [isComplex] => 1 
      [condition] => and 
      [predicates] => Array 
       (
        [0] => Array 
         (
          [isComplex] => 1 
          [condition] => and 
          [predicates] => Array 
           (
            [0] => Array 
             (
              [isComplex] => 1 
              [condition] => and 
              [predicates] => Array 
               (
                [0] => Array 
                 (
                  [isComplex] => 
                  [field] => NAME 
                  [operator] => startswith 
                  [value] => as 
                  [ignoreCase] => 1 
                 ) 

                [1] => Array 
                 (
                  [isComplex] => 
                  [field] => MAIN_PHONE 
                  [operator] => startswith 
                  [value] => 06 
                  [ignoreCase] => 1 
                 ) 

               ) 

             ) 

            [1] => Array 
             (
              [isComplex] => 
              [field] => COD_FISC 
              [operator] => startswith 
              [value] => 98 
              [ignoreCase] => 1 
             ) 
//array multi 
           ) 

         ) 

        [1] => Array 
         (
          [isComplex] => 
          [field] => id 
          [operator] => startswith 
          [value] => 12 
          [ignoreCase] => 1 
         ) 

       ) 

     ) 


) 

,我想获得的仅具有阵列与密钥字段

ES中的结果: 结果:

[0] => Array 
    (
    [isComplex] => 
    [field] => NAME 
    [operator] => startswith 
    [value] => as 
    [ignoreCase] => 1 
    ) 
[1] => Array 
(
    [isComplex] => 
    [field] => MAIN_PHONE 
    [operator] => startswith 
    [value] => 06 
    [ignoreCase] => 1 
) 
[2] => Array 
(
    [isComplex] => 
    [field] => COD_FISC 
    [operator] => startswith 
    [value] => 98 
    [ignoreCase] => 1 
) 
[3] => Array 
(
    [isComplex] => 
    [field] => id 
    [operator] => startswith 
    [value] => 12 
    [ignoreCase] => 1 
) 

希望这段代码很清楚。有什么建议么?尝试了几种方式,但仍未找到解决方案。

尝试用递归:

$global_var; 

function recursive($node) 
{ 
    // grab informations into $global_var 
    if(has_no_subnodes) return; 
    else recursive($node->subField); 
} 
+0

HOWTO has_no_subnodes? –

+0

'if(!isset(predicates))'? –

+0

没有结果..... –