3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testArray = ['a' => ['b' => 'l'], 'c' => 'm', 'd' => ['n' => 'o']]; $actionArray = ['action' => ['b']]; function toUpperRecursive(array $arr) { foreach ($arr as $key => $val) { if (is_array($val)) { $newKey = strtoupper($key); $arr[$newKey] = toUpperRecursive($val); unset($arr[$key]); } elseif (is_string($val)) { // $arr[$key] = strtoupper($val); echo $val; } } return $arr; } echo "before:\n"; var_export($testArray); echo "after:\n"; var_export(toUpperRecursive($testArray));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J96DZ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $testArray, !1 = $actionArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
   24     2        ECHO                                                     'before%3A%0A'
   25     3        INIT_FCALL                                               'var_export'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   26     6        ECHO                                                     'after%3A%0A'
   27     7        INIT_FCALL                                               'var_export'
          8        INIT_FCALL                                               'toupperrecursive'
          9        SEND_VAR                                                 !0
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function toupperrecursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 21
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/J96DZ
function name:  toUpperRecursive
number of ops:  24
compiled vars:  !0 = $arr, !1 = $val, !2 = $key, !3 = $newKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1      > FE_RESET_R                                       $4      !0, ->21
          2    > > FE_FETCH_R                                       ~5      $4, !1, ->21
          3    >   ASSIGN                                                   !2, ~5
   10     4        TYPE_CHECK                                  128          !1
          5      > JMPZ                                                     ~7, ->17
   11     6    >   INIT_FCALL                                               'strtoupper'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !3, $8
   12    10        INIT_FCALL_BY_NAME                                       'toUpperRecursive'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0  $11     
         13        ASSIGN_DIM                                               !0, !3
         14        OP_DATA                                                  $11
   13    15        UNSET_DIM                                                !0, !2
         16      > JMP                                                      ->20
   15    17    >   TYPE_CHECK                                   64          !1
         18      > JMPZ                                                     ~12, ->20
   17    19    >   ECHO                                                     !1
    8    20    > > JMP                                                      ->2
         21    >   FE_FREE                                                  $4
   21    22      > RETURN                                                   !0
   22    23*     > RETURN                                                   null

End of function toupperrecursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.74 ms | 1403 KiB | 18 Q