3v4l.org

run code in 300+ PHP versions simultaneously
<?php class derp { public function __construct($v) { $this->num = $v; } public function getNum() { return $this->num; } } $d = array(); for($i = 0; $i < 100; $i++) { $d[] = new derp(rand(1,100)); } $nums = array_reduce($d, function($nums, $derp) { if ($nums === null) { $nums = 0; } $nums += $derp->getNum(); return $nums; }); var_dump($nums);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 3
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 3
Branch analysis from position: 15
Branch analysis from position: 3
filename:       /in/CtVvE
function name:  (null)
number of ops:  25
compiled vars:  !0 = $d, !1 = $i, !2 = $nums
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->13
   13     3    >   NEW                                              $6      'derp'
          4        INIT_FCALL                                               'rand'
          5        SEND_VAL                                                 1
          6        SEND_VAL                                                 100
          7        DO_ICALL                                         $7      
          8        SEND_VAR_NO_REF_EX                                       $7
          9        DO_FCALL                                      0          
         10        ASSIGN_DIM                                               !0
         11        OP_DATA                                                  $6
   12    12        PRE_INC                                                  !1
         13    >   IS_SMALLER                                               !1, 100
         14      > JMPNZ                                                    ~10, ->3
   16    15    >   INIT_FCALL                                               'array_reduce'
         16        SEND_VAR                                                 !0
         17        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FCtVvE%3A16%240'
   22    18        SEND_VAL                                                 ~11
         19        DO_ICALL                                         $12     
   16    20        ASSIGN                                                   !2, $12
   24    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FCtVvE%3A16%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/CtVvE
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $nums, !1 = $derp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        TYPE_CHECK                                    2          !0
          3      > JMPZ                                                     ~2, ->5
   18     4    >   ASSIGN                                                   !0, 0
   20     5    >   INIT_METHOD_CALL                                         !1, 'getNum'
          6        DO_FCALL                                      0  $4      
          7        ASSIGN_OP                                     1          !0, $4
   21     8      > RETURN                                                   !0
   22     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FCtVvE%3A16%240

Class derp:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CtVvE
function name:  __construct
number of ops:  4
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN_OBJ                                               'num'
          2        OP_DATA                                                  !0
    5     3      > RETURN                                                   null

End of function __construct

Function getnum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CtVvE
function name:  getNum
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_R                                      ~0      'num'
          1      > RETURN                                                   ~0
    8     2*     > RETURN                                                   null

End of function getnum

End of class derp.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.69 ms | 1400 KiB | 19 Q