3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ ['moo' => 'abc', 'foo' => 1], ['moo' => 'gyu', 'foo' => 2] ]; $newArr = array_reduce($arr, function($carry, $item){ if ($item['moo'] == 'gyu') $carry = $item; return $carry; }); print_r($newArr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QUVRm
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arr, !1 = $newArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        INIT_FCALL                                               'array_reduce'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
   12     4        SEND_VAL                                                 ~3
    8     5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !1, $4
   14     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > 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 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/QUVRm
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $carry, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        FETCH_DIM_R                                      ~2      !1, 'moo'
          3        IS_EQUAL                                                 ~2, 'gyu'
          4      > JMPZ                                                     ~3, ->6
   10     5    >   ASSIGN                                                   !0, !1
   11     6    > > RETURN                                                   !0
   12     7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
210.69 ms | 1002 KiB | 15 Q