3v4l.org

run code in 300+ PHP versions simultaneously
<?php $blah= array(array('a'=> array('name' => 'test'), '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) { $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/9DDXH
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>
   26     2        INIT_FCALL                                               '_test'
          3        SEND_REF                                                 !0
          4        SEND_REF                                                 !1
          5        DO_FCALL                                      0          
   28     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 = 40
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 40
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 = 23
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 30
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 39
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 39
Branch analysis from position: 30
Branch analysis from position: 23
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/9DDXH
function name:  _test
number of ops:  42
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, ->40
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->40
          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, ->23
   10    12    >   ASSIGN                                                   !4, <array>
   11    13        INIT_FCALL                                               'array_merge'
         14        SEND_VAR                                                 !4
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $13     
         17        ASSIGN                                                   !4, $13
   12    18        FETCH_DIM_UNSET                                  $15     !4, !3
         19        UNSET_DIM                                                $15, 'alias'
   13    20        FETCH_DIM_R                                      ~16     !2, 'alias'
         21        ASSIGN_DIM                                               !1, ~16
         22        OP_DATA                                                  !4
   16    23    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~18     !2, 'isalias'
         24        TYPE_CHECK                                    8          ~18
         25      > JMPZ                                                     ~19, ->30
   17    26    >   FETCH_DIM_R                                      ~21     !2, 'name'
         27        FETCH_DIM_R                                      ~22     !1, ~21
         28        ASSIGN_DIM                                               !0, !3
         29        OP_DATA                                                  ~22
   20    30    >   TYPE_CHECK                                  128  ~23     !2
         31        TYPE_CHECK                                    8          ~23
         32      > JMPZ                                                     ~24, ->39
   21    33    >   INIT_FCALL_BY_NAME                                       '_test'
         34        CHECK_FUNC_ARG                                           
         35        FETCH_DIM_FUNC_ARG                               $25     !0, !3
         36        SEND_FUNC_ARG                                            $25
         37        SEND_VAR_EX                                              !1
         38        DO_FCALL                                      0          
    6    39    > > JMP                                                      ->3
         40    >   FE_FREE                                                  $5
   24    41      > RETURN                                                   null

End of function _test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.61 ms | 1403 KiB | 18 Q