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 = []; $last = 0; for ($i = 0; $i < 500; $i++) { $foo->bar(); $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 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 7
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 7
Branch analysis from position: 27
Branch analysis from position: 7
Branch analysis from position: 24
filename:       /in/0BJ1n
function name:  (null)
number of ops:  31
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                                                      ->25
   15     7    >   INIT_METHOD_CALL                                         !0, 'bar'
          8        DO_FCALL                                      0          
   16     9        INIT_FCALL                                               'round'
         10        INIT_FCALL                                               'memory_get_peak_usage'
         11        SEND_VAL                                                 <true>
         12        DO_ICALL                                         $12     
         13        DIV                                              ~13     $12, 1024
         14        DIV                                              ~14     ~13, 1024
         15        SEND_VAL                                                 ~14
         16        SEND_VAL                                                 2
         17        DO_ICALL                                         $15     
         18        ASSIGN                                                   !4, $15
   17    19        IS_NOT_EQUAL                                             !4, !2
         20      > JMPZ                                                     ~17, ->24
   18    21    >   ASSIGN_DIM                                               !1
         22        OP_DATA                                                  !4
   19    23        ASSIGN                                                   !2, !4
   14    24    >   PRE_INC                                                  !3
         25    >   IS_SMALLER                                               !3, 500
         26      > JMPNZ                                                    ~21, ->7
   23    27    >   INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0BJ1n
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:
156.42 ms | 1392 KiB | 19 Q