3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'a' => array( 'a' => 'apple', 'b' => 'banana', 'c' => 'cranberry', 'd' => 'mango', 'e' => 'pineapple' ), 'b' => array( 'a' => 'apple', 'b' => 'banana', 'c' => 'cranberry', 'd' => 'mango', 'e' => 'pineapple' ), 'c' => 'cranberry', 'd' => 'mango', 'e' => 'pineapple' ); function test(&$child, $entry) { $i = 1; foreach ($child AS $key => $fruit) { if (!is_numeric($key)) { $child[$i] = $fruit; unset($child[$key]); $i++; } } } $i = 1; foreach ($arr AS $key => $fruit) { $arr[$i] = $fruit; if (is_array($fruit)) { test($arr[$i], $fruit); } unset($arr[$key]); $i++; } var_dump($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/XrVYT
function name:  (null)
number of ops:  22
compiled vars:  !0 = $arr, !1 = $i, !2 = $fruit, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   37     1        ASSIGN                                                   !1, 1
   39     2      > FE_RESET_R                                       $6      !0, ->17
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->17
          4    >   ASSIGN                                                   !3, ~7
   41     5        ASSIGN_DIM                                               !0, !1
          6        OP_DATA                                                  !2
   43     7        TYPE_CHECK                                  128          !2
          8      > JMPZ                                                     ~10, ->14
   45     9    >   INIT_FCALL                                               'test'
         10        FETCH_DIM_W                                      $11     !0, !1
         11        SEND_REF                                                 $11
         12        SEND_VAR                                                 !2
         13        DO_FCALL                                      0          
   48    14    >   UNSET_DIM                                                !0, !3
   49    15        PRE_INC                                                  !1
   39    16      > JMP                                                      ->3
         17    >   FE_FREE                                                  $6
   52    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 15
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/XrVYT
function name:  test
number of ops:  18
compiled vars:  !0 = $child, !1 = $entry, !2 = $i, !3 = $fruit, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        ASSIGN                                                   !2, 1
   26     3      > FE_RESET_R                                       $6      !0, ->16
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->16
          5    >   ASSIGN                                                   !4, ~7
   28     6        INIT_FCALL                                               'is_numeric'
          7        SEND_VAR                                                 !4
          8        DO_ICALL                                         $9      
          9        BOOL_NOT                                         ~10     $9
         10      > JMPZ                                                     ~10, ->15
   30    11    >   ASSIGN_DIM                                               !0, !2
         12        OP_DATA                                                  !3
   31    13        UNSET_DIM                                                !0, !4
   32    14        PRE_INC                                                  !2
   26    15    > > JMP                                                      ->4
         16    >   FE_FREE                                                  $6
   35    17      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.13 ms | 1403 KiB | 18 Q