3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = 'foo/bar/baz'; $root = array('foo' => array('bar' => array('baz' => 'something'))); function bla(&$root, $path, $value) { $paths = explode('/', $path); $current = &$root; foreach ($paths as $path) { if (isset($current[$path])) { $current = &$current[$path]; } else { return null; } } return $current[$value] = $value; } bla($root, $path, '123'); var_dump($root);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iUm08
function name:  (null)
number of ops:  11
compiled vars:  !0 = $path, !1 = $root
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'foo%2Fbar%2Fbaz'
    4     1        ASSIGN                                                   !1, <array>
   22     2        INIT_FCALL                                               'bla'
          3        SEND_REF                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 '123'
          6        DO_FCALL                                      0          
   24     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function bla:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/iUm08
function name:  bla
number of ops:  24
compiled vars:  !0 = $root, !1 = $path, !2 = $value, !3 = $paths, !4 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    8     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%2F'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !3, $5
    9     8        ASSIGN_REF                                               !4, !0
   11     9      > FE_RESET_R                                       $8      !3, ->19
         10    > > FE_FETCH_R                                               $8, !1, ->19
   12    11    >   ISSET_ISEMPTY_DIM_OBJ                         0          !4, !1
         12      > JMPZ                                                     ~9, ->16
   13    13    >   FETCH_DIM_W                                      $10     !4, !1
         14        ASSIGN_REF                                               !4, $10
         15      > JMP                                                      ->18
   15    16    >   FE_FREE                                                  $8
         17      > RETURN                                                   null
   11    18    > > JMP                                                      ->10
         19    >   FE_FREE                                                  $8
   19    20        ASSIGN_DIM                                       ~12     !4, !2
         21        OP_DATA                                                  !2
         22      > RETURN                                                   ~12
   20    23*     > RETURN                                                   null

End of function bla

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.69 ms | 1403 KiB | 18 Q