3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $a; public function __construct() { $this->a = function () { return true; }; } public function doAction() { $result = array(); for ($i = 0; $i < 100; ++$i) { $result[] = mt_rand(); } call_user_func($this->a); } } for ($i = 0; $i < 10000; ++$i) { var_dump(memory_get_usage(true)); $a = new A(); $a->doAction(); //gc_collect_cycles(); //this fixes 5.5 }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 2
Branch analysis from position: 16
Branch analysis from position: 2
filename:       /in/v1DZN
function name:  (null)
number of ops:  17
compiled vars:  !0 = $i, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->14
   20     2    >   INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'memory_get_usage'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   21     8        NEW                                              $5      'A'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $5
   22    11        INIT_METHOD_CALL                                         !1, 'doAction'
         12        DO_FCALL                                      0          
   19    13        PRE_INC                                                  !0
         14    >   IS_SMALLER                                               !0, 10000
         15      > JMPNZ                                                    ~10, ->2
   24    16    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fv1DZN%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v1DZN
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   <true>
          1*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fv1DZN%3A7%240

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v1DZN
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fv1DZN%3A7%240'
          1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  ~1
    8     3      > RETURN                                                   null

End of function __construct

Function doaction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/v1DZN
function name:  doAction
number of ops:  14
compiled vars:  !0 = $result, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->8
   13     3    >   INIT_FCALL                                               'mt_rand'
          4        DO_ICALL                                         $5      
          5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  $5
   12     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, 100
          9      > JMPNZ                                                    ~7, ->3
   15    10    >   FETCH_OBJ_R                                      ~8      'a'
         11        INIT_USER_CALL                                0          'call_user_func', ~8
         12        DO_FCALL                                      0          
   16    13      > RETURN                                                   null

End of function doaction

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.09 ms | 1400 KiB | 19 Q