3v4l.org

run code in 300+ PHP versions simultaneously
<?php class StackContainer { protected $stack; public function __construct( $stack_depth ) { for( $stack_level = 0; $stack_level < $stack_depth; $stack_level++ ) $this->stack[] = "Some\Namespace\To\Class$stack_level"; } } foreach( [2, 4, 8, 12, 16] as $depth ) { $depth = 2**$depth; $mem_before = memory_get_usage(); $instance = new StackContainer( $depth ); $mem_usage_kb = ( memory_get_usage() - $mem_before ) >> 10; unset( $instance ); printf("%8d elements involved %8d kB\n", $depth, $mem_usage_kb); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 1, Position 2 = 23
Branch analysis from position: 1
2 jumps found. (Code = 78) Position 1 = 2, Position 2 = 23
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/cEoe4
function name:  (null)
number of ops:  25
compiled vars:  !0 = $depth, !1 = $mem_before, !2 = $instance, !3 = $mem_usage_kb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > FE_RESET_R                                       $4      <array>, ->23
          1    > > FE_FETCH_R                                               $4, !0, ->23
   13     2    >   POW                                              ~5      2, !0
          3        ASSIGN                                                   !0, ~5
   14     4        INIT_FCALL                                               'memory_get_usage'
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !1, $7
   15     7        NEW                                              $9      'StackContainer'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $9
   16    11        INIT_FCALL                                               'memory_get_usage'
         12        DO_ICALL                                         $12     
         13        SUB                                              ~13     $12, !1
         14        SR                                               ~14     ~13, 10
         15        ASSIGN                                                   !3, ~14
   17    16        UNSET_CV                                                 !2
   18    17        INIT_FCALL                                               'printf'
         18        SEND_VAL                                                 '%258d+elements+involved+%258d+kB%0A'
         19        SEND_VAR                                                 !0
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                                 
   12    22      > JMP                                                      ->1
         23    >   FE_FREE                                                  $4
   19    24      > RETURN                                                   1

Class StackContainer:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
Branch analysis from position: 3
filename:       /in/cEoe4
function name:  __construct
number of ops:  12
compiled vars:  !0 = $stack_depth, !1 = $stack_level
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->9
    8     3    >   NOP                                                      
          4        FAST_CONCAT                                      ~5      'Some%5CNamespace%5CTo%5CClass', !1
          5        FETCH_OBJ_W                                      $3      'stack'
          6        ASSIGN_DIM                                               $3
          7        OP_DATA                                                  ~5
    7     8        PRE_INC                                                  !1
          9    >   IS_SMALLER                                               !1, !0
         10      > JMPNZ                                                    ~7, ->3
    9    11    > > RETURN                                                   null

End of function __construct

End of class StackContainer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.11 ms | 1008 KiB | 15 Q