3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
based on 7PRN5
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 27
Branch analysis from position: 27
Jump found. Position 1 = 29, Position 2 = 8
Branch analysis from position: 29
Jump found. Position 1 = -2
Branch analysis from position: 8
Jump found. Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
Jump found. Position 1 = 29, Position 2 = 8
Branch analysis from position: 29
Branch analysis from position: 8
Branch analysis from position: 25
filename:       /in/0BJ1n
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
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  10     1        NEW                                              $6      :-6
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $6
  12     4        ASSIGN                                                   !1, <array>
  13     5        ASSIGN                                                   !2, 0
  14     6        ASSIGN                                                   !3, 0
         7      > JMP                                                      ->27
  15     8    >   INIT_METHOD_CALL                                         !0, 'bar'
         9        DO_FCALL                                      0          
  16    10        INIT_FCALL                                               'round'
        11        INIT_FCALL                                               'memory_get_peak_usage'
        12        SEND_VAL                                                 <true>
        13        DO_ICALL                                         $13     
        14        DIV                                              ~14     $13, 1024
        15        DIV                                              ~15     ~14, 1024
        16        SEND_VAL                                                 ~15
        17        SEND_VAL                                                 2
        18        DO_ICALL                                         $16     
        19        ASSIGN                                                   !4, $16
  17    20        IS_NOT_EQUAL                                     ~18     !4, !2
        21      > JMPZ                                                     ~18, ->25
  18    22    >   ASSIGN_DIM                                               !1
        23        OP_DATA                                                  !4
  19    24        ASSIGN                                                   !2, !4
  14    25    >   POST_INC                                         ~21     !3
        26        FREE                                                     ~21
        27    >   IS_SMALLER                                       ~22     !3, 500
        28      > JMPNZ                                                    ~22, ->8
  23    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
Jump found. Position 1 = -2
filename:       /in/0BJ1n
function name:  bar
number of ops:  4
compiled vars:  !0 = $this
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   6     0  E >   CLONE                                            $2      !0
         1        ASSIGN_OBJ                                               'orig'
         2        OP_DATA                                                  $2
   7     3      > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 7.3.0