3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isEmptyArray($item) { if (is_array($item)) { return array_filter($item, 'isEmptyArray'); } if (!empty($item) || $item === "0") { return true; } return false; } function removeEmptyArrays($array) { $filteredArray = array_filter($array, 'isEmptyArray'); return $filteredArray; } function isMultiDimensional($array) { if(is_array($array)) { foreach ($array as $key=>$value){ if(is_array($value)){ return true; } } } return false; } $options_array = array("acct"=>array("acct_row"=>array("billing_group"=> array ("billing_group_row"=> array ('0' => array("billing_group_name"=>"", "billing_group_description"=> "", "list_start_master_file"=> "0" )))))); $options = array(); $apiLiveOptions = array(); foreach ($options_array AS $key => $value) { if (is_array($value)) { if (!empty($value[$key])) { $options[$key] = $value; $apiLiveOptions[$key] = $value; } else { $array = array(); $apiLiveArray = array(); foreach ($value as $k => $v) { if(!empty($v[$k])) { $array[] = $value[$k]; $apiLiveArray[] = $value[$k]; $options[$key] = $array; } else { $newArray = array_filter($v, 'removeEmptyArrays'); $apiLiveArray[$k] = $newArray; foreach($newArray as $row => $column) { if(is_array($column)) { var_dump($column); foreach($column as $r=>$c) { $options[$row][$r]=$c; } } else { $array[$k]=$column; $options[$row] = $array; } } } } $apiLiveOptions[$key] = $apiLiveArray; } } else { $options[$key] = $value; $apiLiveOptions[$key] = $value; } }; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 73
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 73
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 68
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 64
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 64
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 33
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 33
2 jumps found. (Code = 77) Position 1 = 41, Position 2 = 62
Branch analysis from position: 41
2 jumps found. (Code = 78) Position 1 = 42, Position 2 = 62
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 57
Branch analysis from position: 45
2 jumps found. (Code = 77) Position 1 = 49, Position 2 = 55
Branch analysis from position: 49
2 jumps found. (Code = 78) Position 1 = 50, Position 2 = 55
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 55
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 62
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
Branch analysis from position: 64
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 73
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 73
filename:       /in/i8GYT
function name:  (null)
number of ops:  75
compiled vars:  !0 = $options_array, !1 = $options, !2 = $apiLiveOptions, !3 = $value, !4 = $key, !5 = $array, !6 = $apiLiveArray, !7 = $v, !8 = $k, !9 = $newArray, !10 = $column, !11 = $row, !12 = $c, !13 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   ASSIGN                                                   !0, <array>
   35     1        ASSIGN                                                   !1, <array>
   36     2        ASSIGN                                                   !2, <array>
   37     3      > FE_RESET_R                                       $17     !0, ->73
          4    > > FE_FETCH_R                                       ~18     $17, !3, ->73
          5    >   ASSIGN                                                   !4, ~18
   38     6        TYPE_CHECK                                  128          !3
          7      > JMPZ                                                     ~20, ->68
   39     8    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~21     !3, !4
          9        BOOL_NOT                                         ~22     ~21
         10      > JMPZ                                                     ~22, ->16
   40    11    >   ASSIGN_DIM                                               !1, !4
         12        OP_DATA                                                  !3
   41    13        ASSIGN_DIM                                               !2, !4
         14        OP_DATA                                                  !3
         15      > JMP                                                      ->67
   43    16    >   ASSIGN                                                   !5, <array>
   44    17        ASSIGN                                                   !6, <array>
   45    18      > FE_RESET_R                                       $27     !3, ->64
         19    > > FE_FETCH_R                                       ~28     $27, !7, ->64
         20    >   ASSIGN                                                   !8, ~28
   46    21        ISSET_ISEMPTY_DIM_OBJ                         1  ~30     !7, !8
         22        BOOL_NOT                                         ~31     ~30
         23      > JMPZ                                                     ~31, ->33
   47    24    >   FETCH_DIM_R                                      ~33     !3, !8
         25        ASSIGN_DIM                                               !5
         26        OP_DATA                                                  ~33
   48    27        FETCH_DIM_R                                      ~35     !3, !8
         28        ASSIGN_DIM                                               !6
         29        OP_DATA                                                  ~35
   49    30        ASSIGN_DIM                                               !1, !4
         31        OP_DATA                                                  !5
         32      > JMP                                                      ->63
   51    33    >   INIT_FCALL                                               'array_filter'
         34        SEND_VAR                                                 !7
         35        SEND_VAL                                                 'removeEmptyArrays'
         36        DO_ICALL                                         $37     
         37        ASSIGN                                                   !9, $37
   52    38        ASSIGN_DIM                                               !6, !8
         39        OP_DATA                                                  !9
   53    40      > FE_RESET_R                                       $40     !9, ->62
         41    > > FE_FETCH_R                                       ~41     $40, !10, ->62
         42    >   ASSIGN                                                   !11, ~41
   54    43        TYPE_CHECK                                  128          !10
         44      > JMPZ                                                     ~43, ->57
   55    45    >   INIT_FCALL                                               'var_dump'
         46        SEND_VAR                                                 !10
         47        DO_ICALL                                                 
   56    48      > FE_RESET_R                                       $45     !10, ->55
         49    > > FE_FETCH_R                                       ~46     $45, !12, ->55
         50    >   ASSIGN                                                   !13, ~46
   57    51        FETCH_DIM_W                                      $48     !1, !11
         52        ASSIGN_DIM                                               $48, !13
         53        OP_DATA                                                  !12
   56    54      > JMP                                                      ->49
         55    >   FE_FREE                                                  $45
         56      > JMP                                                      ->61
   60    57    >   ASSIGN_DIM                                               !5, !8
         58        OP_DATA                                                  !10
   61    59        ASSIGN_DIM                                               !1, !11
         60        OP_DATA                                                  !5
   53    61    > > JMP                                                      ->41
         62    >   FE_FREE                                                  $40
   45    63    > > JMP                                                      ->19
         64    >   FE_FREE                                                  $27
   66    65        ASSIGN_DIM                                               !2, !4
         66        OP_DATA                                                  !6
         67    > > JMP                                                      ->72
   69    68    >   ASSIGN_DIM                                               !1, !4
         69        OP_DATA                                                  !3
   70    70        ASSIGN_DIM                                               !2, !4
         71        OP_DATA                                                  !3
   37    72    > > JMP                                                      ->4
         73    >   FE_FREE                                                  $17
   74    74      > RETURN                                                   1

Function isemptyarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 47) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/i8GYT
function name:  isEmptyArray
number of ops:  17
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~1, ->8
    5     3    >   INIT_FCALL                                               'array_filter'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 'isEmptyArray'
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
    8     8    >   ISSET_ISEMPTY_CV                                 ~3      !0
          9        BOOL_NOT                                         ~4      ~3
         10      > JMPNZ_EX                                         ~4      ~4, ->13
         11    >   IS_IDENTICAL                                     ~5      !0, '0'
         12        BOOL                                             ~4      ~5
         13    > > JMPZ                                                     ~4, ->15
    9    14    > > RETURN                                                   <true>
   12    15    > > RETURN                                                   <false>
   13    16*     > RETURN                                                   null

End of function isemptyarray

Function removeemptyarrays:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i8GYT
function name:  removeEmptyArrays
number of ops:  8
compiled vars:  !0 = $array, !1 = $filteredArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'isEmptyArray'
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
   18     6      > RETURN                                                   !1
   19     7*     > RETURN                                                   null

End of function removeemptyarrays

Function ismultidimensional:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
Branch analysis from position: 12
filename:       /in/i8GYT
function name:  isMultiDimensional
number of ops:  14
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~3, ->12
   24     3    > > FE_RESET_R                                       $4      !0, ->11
          4    > > FE_FETCH_R                                       ~5      $4, !1, ->11
          5    >   ASSIGN                                                   !2, ~5
   25     6        TYPE_CHECK                                  128          !1
          7      > JMPZ                                                     ~7, ->10
   26     8    >   FE_FREE                                                  $4
          9      > RETURN                                                   <true>
   24    10    > > JMP                                                      ->4
         11    >   FE_FREE                                                  $4
   30    12    > > RETURN                                                   <false>
   31    13*     > RETURN                                                   null

End of function ismultidimensional

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.74 ms | 953 KiB | 18 Q