3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'price' => [ 'cost' => 200, 'tax' => 10, 'total' => 210 ], 'otherKey' => 'etc' ], [ 'price' => [ 'cost' => 500, 'tax' => 50, 'total' => 550 ], 'otherKey' => 'etc' ], [ 'price' => [ 'cost' => 600, 'tax' => 60, 'total' => 660 ], 'otherKey' => 'etc' ], ]; $totals = []; array_walk_recursive( $array, function($leafNode, $key) use(&$totals) { if ($key === 'total') { $totals[] = $leafNode; } } ); var_export($totals);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hATcK
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array, !1 = $totals
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   25     1        ASSIGN                                                   !1, <array>
   26     2        INIT_FCALL                                               'array_walk_recursive'
   27     3        SEND_REF                                                 !0
   28     4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !1
   32     6        SEND_VAL                                                 ~4
   26     7        DO_ICALL                                                 
   34     8        INIT_FCALL                                               'var_export'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/hATcK
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $leafNode, !1 = $key, !2 = $totals
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   29     3        IS_IDENTICAL                                             !1, 'total'
          4      > JMPZ                                                     ~3, ->7
   30     5    >   ASSIGN_DIM                                               !2
          6        OP_DATA                                                  !0
   32     7    > > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
258.09 ms | 1011 KiB | 15 Q