3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = json_encode(array('sleep' => 123)); $b = json_encode(array('sleep' => 987)); $logs = array(array('date' => '2014-01-01', 'data' => $a), array('date' => '2015-01-01', 'data' => $b)); $result = array_reduce($logs, function ($cur, $x) { var_dump($x); //$cur[$x] = $x; return $cur; }, array()); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X9ok4
function name:  (null)
number of ops:  26
compiled vars:  !0 = $a, !1 = $b, !2 = $logs, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'json_encode'
          1        SEND_VAL                                                 <array>
          2        DO_ICALL                                         $4      
          3        ASSIGN                                                   !0, $4
    3     4        INIT_FCALL                                               'json_encode'
          5        SEND_VAL                                                 <array>
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !1, $6
    4     8        INIT_ARRAY                                       ~8      '2014-01-01', 'date'
          9        ADD_ARRAY_ELEMENT                                ~8      !0, 'data'
         10        INIT_ARRAY                                       ~9      ~8
         11        INIT_ARRAY                                       ~10     '2015-01-01', 'date'
         12        ADD_ARRAY_ELEMENT                                ~10     !1, 'data'
         13        ADD_ARRAY_ELEMENT                                ~9      ~10
         14        ASSIGN                                                   !2, ~9
    6    15        INIT_FCALL                                               'array_reduce'
         16        SEND_VAR                                                 !2
         17        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FX9ok4%3A6%240'
   10    18        SEND_VAL                                                 ~12
         19        SEND_VAL                                                 <array>
         20        DO_ICALL                                         $13     
    6    21        ASSIGN                                                   !3, $13
   12    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FX9ok4%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X9ok4
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $cur, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                                 
    9     5      > RETURN                                                   !0
   10     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FX9ok4%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.42 ms | 1396 KiB | 19 Q