3v4l.org

run code in 300+ PHP versions simultaneously
<?php function assignArrayByPath(&$arr, $path, $value, $separator = '_') { $keys = explode($separator, $path); foreach ($keys as $key) { $arr = &$arr[$key]; } $arr = $value; } $array = [ 'max_size_video' => 50000, 'max_size_photo' => 8000, 'token_expire' => 100, 'dns' => 'mydns.fr', ]; foreach ($array as $key => $value) { unset($array[$key]); assignArrayByPath($array, $key, $value); } var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 11
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/pcGhM
function name:  (null)
number of ops:  16
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   18     1      > FE_RESET_R                                       $4      !0, ->11
          2    > > FE_FETCH_R                                       ~5      $4, !1, ->11
          3    >   ASSIGN                                                   !2, ~5
   19     4        UNSET_DIM                                                !0, !2
   20     5        INIT_FCALL                                               'assignarraybypath'
          6        SEND_REF                                                 !0
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0          
   18    10      > JMP                                                      ->2
         11    >   FE_FREE                                                  $4
   22    12        INIT_FCALL                                               'var_export'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function assignarraybypath:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/pcGhM
function name:  assignArrayByPath
number of ops:  17
compiled vars:  !0 = $arr, !1 = $path, !2 = $value, !3 = $separator, !4 = $keys, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV_INIT                                        !3      '_'
    4     4        INIT_FCALL                                               'explode'
          5        SEND_VAR                                                 !3
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !4, $6
    5     9      > FE_RESET_R                                       $8      !4, ->14
         10    > > FE_FETCH_R                                               $8, !5, ->14
    6    11    >   FETCH_DIM_W                                      $9      !0, !5
         12        ASSIGN_REF                                               !0, $9
    5    13      > JMP                                                      ->10
         14    >   FE_FREE                                                  $8
    8    15        ASSIGN                                                   !0, !2
    9    16      > RETURN                                                   null

End of function assignarraybypath

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.31 ms | 1403 KiB | 18 Q