3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( 1, array (1, 2, array ( 1, 2 ) ), array (1, 2, 3), 2, array( 1, array ( 1, array (1, 2) ), ) , ); function findActives($array, $path_child=null){ foreach ($array as $key => $unknown ) { $path_child[] = $array[$key]; /* if (in_array('2') { $path_child = array($key, "active"); } */ if (is_array($unknown)) { findActives($unknown, $path_child); } } return ($path_child); } // findActives($array); function flatten(array $array) { $return = array(); array_walk_recursive($array, function($a) use (&$return) { $return[] = $a; }); return $return; } $path_child = flatten($array); print_r($path_child);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YMGOD
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array, !1 = $path_child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   39     1        INIT_FCALL                                               'flatten'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   41     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function findactives:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/YMGOD
function name:  findActives
number of ops:  18
compiled vars:  !0 = $array, !1 = $path_child, !2 = $unknown, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   19     2      > FE_RESET_R                                       $4      !0, ->15
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->15
          4    >   ASSIGN                                                   !3, ~5
   20     5        FETCH_DIM_R                                      ~8      !0, !3
          6        ASSIGN_DIM                                               !1
          7        OP_DATA                                                  ~8
   24     8        TYPE_CHECK                                  128          !2
          9      > JMPZ                                                     ~9, ->14
   25    10    >   INIT_FCALL_BY_NAME                                       'findActives'
         11        SEND_VAR_EX                                              !2
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
   19    14    > > JMP                                                      ->3
         15    >   FE_FREE                                                  $4
   28    16      > RETURN                                                   !1
   29    17*     > RETURN                                                   null

End of function findactives

Function flatten:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YMGOD
function name:  flatten
number of ops:  10
compiled vars:  !0 = $array, !1 = $return
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   34     1        ASSIGN                                                   !1, <array>
   35     2        INIT_FCALL                                               'array_walk_recursive'
          3        SEND_REF                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FYMGOD%3A35%240'
          5        BIND_LEXICAL                                             ~3, !1
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                                 
   36     8      > RETURN                                                   !1
   37     9*     > RETURN                                                   null

End of function flatten

Function %00%7Bclosure%7D%2Fin%2FYMGOD%3A35%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YMGOD
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $a, !1 = $return
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        ASSIGN_DIM                                               !1
          3        OP_DATA                                                  !0
          4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FYMGOD%3A35%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.28 ms | 1403 KiB | 18 Q