3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Example input #1 $ex_input_1 = array( 'files' => array( 0 => array( 'name' => 'file.jpg', 'size' => '244235', 'tmp_name' => '/usr/tmp/24ffds.tmp', 'error' => 0 ), 1 => array( 'name' => '', 'size' => '', 'tmp_name' => '', 'error' => 4 ) ), 'cover' => array( 'name' => '', 'size' => '', 'tmp_name' => '', 'error' => 4 ), 'document' => array( 'name' => 'file.doc', 'size' => '244235', 'tmp_name' => '/usr/tmp/24ffds.tmp', 'error' => 0 ) ); // Example input #2 $ex_input_2 = array( 0 => array( 'name' => 'file.jpg', 'size' => '244235', 'tmp_name' => '/usr/tmp/24ffds.tmp', 'error' => 0 ), 1 => array( 'name' => '', 'size' => '', 'tmp_name' => '', 'error' => 4 ) ); function array_filter_recursive($array) { if (isset($array['error'])) { // bottom of tree return $array['error'] == 4 ? array() : $array; } foreach ($array as $key => $value) { $array[$key] = array_filter_recursive($value); } // remove any empty values return array_filter($array); } print_r(array_filter_recursive($ex_input_1)); print_r(array_filter_recursive($ex_input_2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9fNVr
function name:  (null)
number of ops:  15
compiled vars:  !0 = $ex_input_1, !1 = $ex_input_2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   36     1        ASSIGN                                                   !1, <array>
   64     2        INIT_FCALL                                               'print_r'
          3        INIT_FCALL                                               'array_filter_recursive'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   65     8        INIT_FCALL                                               'print_r'
          9        INIT_FCALL                                               'array_filter_recursive'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function array_filter_recursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/9fNVr
function name:  array_filter_recursive
number of ops:  25
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E >   RECV                                             !0      
   53     1        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 'error'
          2      > JMPZ                                                     ~3, ->10
   55     3    >   FETCH_DIM_R                                      ~4      !0, 'error'
          4        IS_EQUAL                                                 ~4, 4
          5      > JMPZ                                                     ~5, ->8
          6    >   QM_ASSIGN                                        ~6      <array>
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~6      !0
          9    > > RETURN                                                   ~6
   57    10    > > FE_RESET_R                                       $7      !0, ->19
         11    > > FE_FETCH_R                                       ~8      $7, !1, ->19
         12    >   ASSIGN                                                   !2, ~8
   58    13        INIT_FCALL_BY_NAME                                       'array_filter_recursive'
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0  $11     
         16        ASSIGN_DIM                                               !0, !2
         17        OP_DATA                                                  $11
   57    18      > JMP                                                      ->11
         19    >   FE_FREE                                                  $7
   61    20        INIT_FCALL                                               'array_filter'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $12     
         23      > RETURN                                                   $12
   62    24*     > RETURN                                                   null

End of function array_filter_recursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.55 ms | 1019 KiB | 17 Q