3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arX = Array('AAA' => 173.696, 'BBB' => 72.436, 'CCC' => 142.692); $arY = Array('AAA' => 127, 'DDD' => 72.333); $newArray = []; $callback = function($value, $key , $prefix) use (&$newArray) { if (!isset($newArray[$key])) { $newArray[$key] = []; } $newArray[$key] += [$prefix => $value]; }; array_walk($arX , $callback , "X"); array_walk($arY , $callback , "Y"); var_dump($newArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rrZgF
function name:  (null)
number of ops:  20
compiled vars:  !0 = $arX, !1 = $arY, !2 = $newArray, !3 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    7     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FrrZgF%3A7%240'
          4        BIND_LEXICAL                                             ~7, !2
          5        ASSIGN                                                   !3, ~7
   17     6        INIT_FCALL                                               'array_walk'
          7        SEND_REF                                                 !0
          8        SEND_VAR                                                 !3
          9        SEND_VAL                                                 'X'
         10        DO_ICALL                                                 
   18    11        INIT_FCALL                                               'array_walk'
         12        SEND_REF                                                 !1
         13        SEND_VAR                                                 !3
         14        SEND_VAL                                                 'Y'
         15        DO_ICALL                                                 
   20    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FrrZgF%3A7%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/rrZgF
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $value, !1 = $key, !2 = $prefix, !3 = $newArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        BIND_STATIC                                              !3
    9     4        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      !3, !1
          5        BOOL_NOT                                         ~5      ~4
          6      > JMPZ                                                     ~5, ->9
   11     7    >   ASSIGN_DIM                                               !3, !1
          8        OP_DATA                                                  <array>
   14     9    >   INIT_ARRAY                                       ~8      !0, !2
         10        ASSIGN_DIM_OP                +=               1          !3, !1
         11        OP_DATA                                                  ~8
   15    12      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FrrZgF%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.98 ms | 1396 KiB | 17 Q