3v4l.org

run code in 300+ PHP versions simultaneously
<?php $blah= array(array('a'=> array('name' => 'test', 'alias' => 'testa'), 'b' => array('name' => 'test2', 'alias' => 'blah'))); $blank = array(); function _test(&$test, &$blank) { foreach ($test as $key => $value) { if (is_array($value) === false) continue; if (isset($value['alias']) === true) { var_dump('here'); $clonedArray = array(); $clonedArray = array_merge($clonedArray, $test); unset($clonedArray[$key]['alias']); $blank[$value['alias']] = $clonedArray; } if (isset($value['isalias']) === true) { $test[$key] = $blank[$value['name']]; } if (is_array($value) === true){ _test($test[$key], $blank); } } } _test($blah, $blank); var_dump($blah);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gkt2u
function name:  (null)
number of ops:  10
compiled vars:  !0 = $blah, !1 = $blank
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
   27     2        INIT_FCALL                                               '_test'
          3        SEND_REF                                                 !0
          4        SEND_REF                                                 !1
          5        DO_FCALL                                      0          
   29     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function _test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 43
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 43
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 26
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 33
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 42
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 42
Branch analysis from position: 33
Branch analysis from position: 26
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
filename:       /in/gkt2u
function name:  _test
number of ops:  45
compiled vars:  !0 = $test, !1 = $blank, !2 = $value, !3 = $key, !4 = $clonedArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2      > FE_RESET_R                                       $5      !0, ->43
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->43
          4    >   ASSIGN                                                   !3, ~6
    7     5        TYPE_CHECK                                  128  ~8      !2
          6        TYPE_CHECK                                    4          ~8
          7      > JMPZ                                                     ~9, ->9
          8    > > JMP                                                      ->3
    9     9    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~10     !2, 'alias'
         10        TYPE_CHECK                                    8          ~10
         11      > JMPZ                                                     ~11, ->26
   10    12    >   INIT_FCALL                                               'var_dump'
         13        SEND_VAL                                                 'here'
         14        DO_ICALL                                                 
   11    15        ASSIGN                                                   !4, <array>
   12    16        INIT_FCALL                                               'array_merge'
         17        SEND_VAR                                                 !4
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $14     
         20        ASSIGN                                                   !4, $14
   13    21        FETCH_DIM_UNSET                                  $16     !4, !3
         22        UNSET_DIM                                                $16, 'alias'
   14    23        FETCH_DIM_R                                      ~17     !2, 'alias'
         24        ASSIGN_DIM                                               !1, ~17
         25        OP_DATA                                                  !4
   17    26    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~19     !2, 'isalias'
         27        TYPE_CHECK                                    8          ~19
         28      > JMPZ                                                     ~20, ->33
   18    29    >   FETCH_DIM_R                                      ~22     !2, 'name'
         30        FETCH_DIM_R                                      ~23     !1, ~22
         31        ASSIGN_DIM                                               !0, !3
         32        OP_DATA                                                  ~23
   21    33    >   TYPE_CHECK                                  128  ~24     !2
         34        TYPE_CHECK                                    8          ~24
         35      > JMPZ                                                     ~25, ->42
   22    36    >   INIT_FCALL_BY_NAME                                       '_test'
         37        CHECK_FUNC_ARG                                           
         38        FETCH_DIM_FUNC_ARG                               $26     !0, !3
         39        SEND_FUNC_ARG                                            $26
         40        SEND_VAR_EX                                              !1
         41        DO_FCALL                                      0          
    6    42    > > JMP                                                      ->3
         43    >   FE_FREE                                                  $5
   25    44      > RETURN                                                   null

End of function _test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.43 ms | 1403 KiB | 18 Q