3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testArray = ['a' => ['b' => 'l'], 'c' => 'm', 'd' => ['n' => 'o']]; $actionArray = ['b' => 'action']; function toUpperRecursive($arr, $actionArray) { foreach ($arr as $key => $val) { if (is_array($val)) { $newKey = strtoupper($key); $arr[$newKey] = toUpperRecursive($val, $actionArray); unset($arr[$key]); } elseif (is_string($val)) { foreach($actionArray as $actionKey => $action) { if($key === $actionKey) { $arr[$key] = $val . ' + 1111'; } } } } return $arr; } // echo "before:\n"; // var_export($testArray); // echo "after:\n"; // var_export(toUpperRecursive($testArray)); var_export(toUpperRecursive($testArray, $actionArray));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rhd5q
function name:  (null)
number of ops:  10
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>
   36     2        INIT_FCALL                                               'var_export'
          3        INIT_FCALL                                               'toupperrecursive'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

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

End of function toupperrecursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.11 ms | 1468 KiB | 16 Q