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; var_dump($options); 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 = 76
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 76
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 71
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 = 70
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
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 = 67
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 67
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 = 66
Branch analysis from position: 66
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 = 44, Position 2 = 65
Branch analysis from position: 44
2 jumps found. (Code = 78) Position 1 = 45, Position 2 = 65
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 60
Branch analysis from position: 48
2 jumps found. (Code = 77) Position 1 = 52, Position 2 = 58
Branch analysis from position: 52
2 jumps found. (Code = 78) Position 1 = 53, Position 2 = 58
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
Branch analysis from position: 58
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 65
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
Branch analysis from position: 67
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 76
filename:       /in/s6iCV
function name:  (null)
number of ops:  78
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, ->76
          4    > > FE_FETCH_R                                       ~18     $17, !3, ->76
          5    >   ASSIGN                                                   !4, ~18
   38     6        TYPE_CHECK                                  128          !3
          7      > JMPZ                                                     ~20, ->71
   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                                                      ->70
   43    16    >   ASSIGN                                                   !5, <array>
   44    17        ASSIGN                                                   !6, <array>
   45    18      > FE_RESET_R                                       $27     !3, ->67
         19    > > FE_FETCH_R                                       ~28     $27, !7, ->67
         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                                                      ->66
   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        INIT_FCALL                                               'var_dump'
         41        SEND_VAR                                                 !1
         42        DO_ICALL                                                 
   54    43      > FE_RESET_R                                       $41     !9, ->65
         44    > > FE_FETCH_R                                       ~42     $41, !10, ->65
         45    >   ASSIGN                                                   !11, ~42
   55    46        TYPE_CHECK                                  128          !10
         47      > JMPZ                                                     ~44, ->60
   56    48    >   INIT_FCALL                                               'var_dump'
         49        SEND_VAR                                                 !10
         50        DO_ICALL                                                 
   57    51      > FE_RESET_R                                       $46     !10, ->58
         52    > > FE_FETCH_R                                       ~47     $46, !12, ->58
         53    >   ASSIGN                                                   !13, ~47
   58    54        FETCH_DIM_W                                      $49     !1, !11
         55        ASSIGN_DIM                                               $49, !13
         56        OP_DATA                                                  !12
   57    57      > JMP                                                      ->52
         58    >   FE_FREE                                                  $46
         59      > JMP                                                      ->64
   61    60    >   ASSIGN_DIM                                               !5, !8
         61        OP_DATA                                                  !10
   62    62        ASSIGN_DIM                                               !1, !11
         63        OP_DATA                                                  !5
   54    64    > > JMP                                                      ->44
         65    >   FE_FREE                                                  $41
   45    66    > > JMP                                                      ->19
         67    >   FE_FREE                                                  $27
   67    68        ASSIGN_DIM                                               !2, !4
         69        OP_DATA                                                  !6
         70    > > JMP                                                      ->75
   70    71    >   ASSIGN_DIM                                               !1, !4
         72        OP_DATA                                                  !3
   71    73        ASSIGN_DIM                                               !2, !4
         74        OP_DATA                                                  !3
   37    75    > > JMP                                                      ->4
         76    >   FE_FREE                                                  $17
   75    77      > 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/s6iCV
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/s6iCV
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/s6iCV
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:
204.12 ms | 1408 KiB | 17 Q