3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ 'a.b.c.d = 1', 'a.b.c.e = Joey', 'a.b.c.f = Smith', 'a.b.g.d = 2', 'a.b.g.e = Chris', 'a.b.g.f = Divner' ]; function mapProfilePrefix($data, $prefix = ''){ // define $temp $temp = array(); foreach($data as $key => $value){ // define $nextKey $nextKey = $prefix . (empty($prefix) ? '' : '.') . $key; if(is_array($value)){ $temp = $temp + mapProfilePrefix($value, $nextKey); } else { $temp[$nextKey] = $value; } } return $temp; } echo mapProfilePrefix($input);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j58N3
function name:  (null)
number of ops:  6
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   30     1        INIT_FCALL                                               'mapprofileprefix'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function mapprofileprefix:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 26
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 26
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
Branch analysis from position: 23
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/j58N3
function name:  mapProfilePrefix
number of ops:  29
compiled vars:  !0 = $data, !1 = $prefix, !2 = $temp, !3 = $value, !4 = $key, !5 = $nextKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
   15     2        ASSIGN                                                   !2, <array>
   17     3      > FE_RESET_R                                       $7      !0, ->26
          4    > > FE_FETCH_R                                       ~8      $7, !3, ->26
          5    >   ASSIGN                                                   !4, ~8
   19     6        ISSET_ISEMPTY_CV                                         !1
          7      > JMPZ                                                     ~10, ->10
          8    >   QM_ASSIGN                                        ~11     ''
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~11     '.'
         11    >   CONCAT                                           ~12     !1, ~11
         12        CONCAT                                           ~13     ~12, !4
         13        ASSIGN                                                   !5, ~13
   21    14        TYPE_CHECK                                  128          !3
         15      > JMPZ                                                     ~15, ->23
   22    16    >   INIT_FCALL_BY_NAME                                       'mapProfilePrefix'
         17        SEND_VAR_EX                                              !3
         18        SEND_VAR_EX                                              !5
         19        DO_FCALL                                      0  $16     
         20        ADD                                              ~17     !2, $16
         21        ASSIGN                                                   !2, ~17
         22      > JMP                                                      ->25
   24    23    >   ASSIGN_DIM                                               !2, !5
         24        OP_DATA                                                  !3
   17    25    > > JMP                                                      ->4
         26    >   FE_FREE                                                  $7
   28    27      > RETURN                                                   !2
   29    28*     > RETURN                                                   null

End of function mapprofileprefix

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.58 ms | 1403 KiB | 14 Q