3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $orig; public function bar() { $this->orig = clone $this; } } $foo = new Foo; $history = array(); $last = 0; for ($i = 0; $i < 5000; $i++) { $foo->bar(); gc_collect_cycles(); $peak = round(memory_get_peak_usage(true) / 1024 / 1024, 2); if ($peak != $last) { $history[] = $peak; $last = $peak; } } var_dump($history);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 7
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 7
Branch analysis from position: 29
Branch analysis from position: 7
Branch analysis from position: 26
filename:       /in/AHtfB
function name:  (null)
number of ops:  33
compiled vars:  !0 = $foo, !1 = $history, !2 = $last, !3 = $i, !4 = $peak
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $5      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $5
   12     3        ASSIGN                                                   !1, <array>
   13     4        ASSIGN                                                   !2, 0
   14     5        ASSIGN                                                   !3, 0
          6      > JMP                                                      ->27
   15     7    >   INIT_METHOD_CALL                                         !0, 'bar'
          8        DO_FCALL                                      0          
   16     9        INIT_FCALL                                               'gc_collect_cycles'
         10        DO_ICALL                                                 
   17    11        INIT_FCALL                                               'round'
         12        INIT_FCALL                                               'memory_get_peak_usage'
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                         $13     
         15        DIV                                              ~14     $13, 1024
         16        DIV                                              ~15     ~14, 1024
         17        SEND_VAL                                                 ~15
         18        SEND_VAL                                                 2
         19        DO_ICALL                                         $16     
         20        ASSIGN                                                   !4, $16
   18    21        IS_NOT_EQUAL                                             !4, !2
         22      > JMPZ                                                     ~18, ->26
   19    23    >   ASSIGN_DIM                                               !1
         24        OP_DATA                                                  !4
   20    25        ASSIGN                                                   !2, !4
   14    26    >   PRE_INC                                                  !3
         27    >   IS_SMALLER                                               !3, 5000
         28      > JMPNZ                                                    ~22, ->7
   24    29    >   INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !1
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AHtfB
function name:  bar
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_THIS                                       ~1      
          1        CLONE                                            ~2      ~1
          2        ASSIGN_OBJ                                               'orig'
          3        OP_DATA                                                  ~2
    7     4      > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.94 ms | 1392 KiB | 21 Q