3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function __construct() { $this->bar = new Bar($this); } } class Bar { function __construct($foo = null) { $this->foo = $foo; } } $usage = 0; $maxima = array(); while (count($maxima) < 5 && $usage < 50000000) { $foo = new Foo(); unset($foo); $last = $usage; $usage = memory_get_usage(); if ($usage < $last) { $maxima[] = $last; } echo number_format($usage)."\n"; } printf("\n\nMaxima: %s\n", implode('; ', $maxima)); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 3
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
Branch analysis from position: 25
Branch analysis from position: 15
Branch analysis from position: 25
filename:       /in/BELr5
function name:  (null)
number of ops:  35
compiled vars:  !0 = $usage, !1 = $maxima, !2 = $foo, !3 = $last
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, 0
   18     1        ASSIGN                                                   !1, <array>
   19     2      > JMP                                                      ->20
   20     3    >   NEW                                              $6      'Foo'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $6
   21     6        UNSET_CV                                                 !2
   22     7        ASSIGN                                                   !3, !0
   23     8        INIT_FCALL                                               'memory_get_usage'
          9        DO_ICALL                                         $10     
         10        ASSIGN                                                   !0, $10
   25    11        IS_SMALLER                                               !0, !3
         12      > JMPZ                                                     ~12, ->15
   26    13    >   ASSIGN_DIM                                               !1
         14        OP_DATA                                                  !3
   29    15    >   INIT_FCALL                                               'number_format'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $14     
         18        CONCAT                                           ~15     $14, '%0A'
         19        ECHO                                                     ~15
   19    20    >   COUNT                                            ~16     !1
         21        IS_SMALLER                                       ~17     ~16, 5
         22      > JMPZ_EX                                          ~17     ~17, ->25
         23    >   IS_SMALLER                                       ~18     !0, 50000000
         24        BOOL                                             ~17     ~18
         25    > > JMPNZ                                                    ~17, ->3
   32    26    >   INIT_FCALL                                               'printf'
         27        SEND_VAL                                                 '%0A%0AMaxima%3A+%25s%0A'
         28        INIT_FCALL                                               'implode'
         29        SEND_VAL                                                 '%3B+'
         30        SEND_VAR                                                 !1
         31        DO_ICALL                                         $19     
         32        SEND_VAR                                                 $19
         33        DO_ICALL                                                 
   33    34      > RETURN                                                   1

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

End of function __construct

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BELr5
function name:  __construct
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV_INIT                                        !0      null
   13     1        ASSIGN_OBJ                                               'foo'
          2        OP_DATA                                                  !0
   14     3      > RETURN                                                   null

End of function __construct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.87 ms | 1400 KiB | 21 Q