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($i); } $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 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
Branch analysis from position: 3
filename:       /in/EOSeo
function name:  (null)
number of ops:  21
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                                                      ->9
   13     3    >   NEW                                              $6      'derp'
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
          6        ASSIGN_DIM                                               !0
          7        OP_DATA                                                  $6
   12     8        PRE_INC                                                  !1
          9    >   IS_SMALLER                                               !1, 100
         10      > JMPNZ                                                    ~9, ->3
   16    11    >   INIT_FCALL                                               'array_reduce'
         12        SEND_VAR                                                 !0
         13        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEOSeo%3A16%240'
   22    14        SEND_VAL                                                 ~10
         15        DO_ICALL                                         $11     
   16    16        ASSIGN                                                   !2, $11
   24    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FEOSeo%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/EOSeo
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%2FEOSeo%3A16%240

Class derp:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EOSeo
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/EOSeo
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:
148.73 ms | 1400 KiB | 17 Q