3v4l.org

run code in 300+ PHP versions simultaneously
<?php function create() { $a = new stdClass(); $b = new stdClass(); $b->a = $a; // $b->cb = function() use ($a) { // }; $a->b = $b; return $a; } echo number_format(memory_get_peak_usage() / 1000000, 2, '.', ' '), " MB\n"; for ($i = 0; $i < 1000; ++$i) { create(); // $a->b = new ArrayObject(); } gc_collect_cycles(); echo number_format(memory_get_peak_usage() / 1000000, 2, '.', ' '), " MB\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 13
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 13
Branch analysis from position: 18
Branch analysis from position: 13
filename:       /in/LVfuv
function name:  (null)
number of ops:  32
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'number_format'
          1        INIT_FCALL                                               'memory_get_peak_usage'
          2        DO_ICALL                                         $1      
          3        DIV                                              ~2      $1, 1000000
          4        SEND_VAL                                                 ~2
          5        SEND_VAL                                                 2
          6        SEND_VAL                                                 '.'
          7        SEND_VAL                                                 '+'
          8        DO_ICALL                                         $3      
          9        ECHO                                                     $3
         10        ECHO                                                     '+MB%0A'
   15    11        ASSIGN                                                   !0, 0
         12      > JMP                                                      ->16
   16    13    >   INIT_FCALL                                               'create'
         14        DO_FCALL                                      0          
   15    15        PRE_INC                                                  !0
         16    >   IS_SMALLER                                               !0, 1000
         17      > JMPNZ                                                    ~7, ->13
   19    18    >   INIT_FCALL                                               'gc_collect_cycles'
         19        DO_ICALL                                                 
   20    20        INIT_FCALL                                               'number_format'
         21        INIT_FCALL                                               'memory_get_peak_usage'
         22        DO_ICALL                                         $9      
         23        DIV                                              ~10     $9, 1000000
         24        SEND_VAL                                                 ~10
         25        SEND_VAL                                                 2
         26        SEND_VAL                                                 '.'
         27        SEND_VAL                                                 '+'
         28        DO_ICALL                                         $11     
         29        ECHO                                                     $11
         30        ECHO                                                     '+MB%0A'
         31      > RETURN                                                   1

Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LVfuv
function name:  create
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   NEW                                              $2      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    5     3        NEW                                              $5      'stdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
    6     6        ASSIGN_OBJ                                               !1, 'a'
          7        OP_DATA                                                  !0
    9     8        ASSIGN_OBJ                                               !0, 'b'
          9        OP_DATA                                                  !1
   10    10      > RETURN                                                   !0
   11    11*     > RETURN                                                   null

End of function create

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.75 ms | 1403 KiB | 20 Q