3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Node { public $parent = NULL; public $childs = array(); function __construct(Node $parent=NULL) { if ($parent) { $parent->childs[] = $this; } $this->childs[] = $this; } function __destruct() { $this->childs = NULL; } } define("MAX", 16); while (true) { printf("Memory: %6.2fMB ->", memory_get_usage()/1024/1024); $top = new Node(); for ($i=0 ; $i<MAX ; $i++) { $ci = new Node($top); for ($j=0 ; $j<MAX ; $j++) { $cj = new Node($ci); for ($k=0 ; $k<MAX ; $k++) { $ck = new Node($cj); } } } printf(" %6.2fMB\n", memory_get_usage()/1024/1024); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 5
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 18
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 5
Branch analysis from position: 55
Branch analysis from position: 5
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 24
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 18
Branch analysis from position: 46
Branch analysis from position: 18
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 30
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 24
Branch analysis from position: 42
Branch analysis from position: 24
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 30
Branch analysis from position: 38
Branch analysis from position: 30
filename:       /in/2FkDf
function name:  (null)
number of ops:  56
compiled vars:  !0 = $top, !1 = $i, !2 = $ci, !3 = $j, !4 = $cj, !5 = $k, !6 = $ck
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'MAX'
          2        SEND_VAL                                                 16
          3        DO_ICALL                                                 
   21     4      > JMP                                                      ->54
   22     5    >   INIT_FCALL                                               'printf'
          6        SEND_VAL                                                 'Memory%3A+%256.2fMB+-%3E'
          7        INIT_FCALL                                               'memory_get_usage'
          8        DO_ICALL                                         $8      
          9        DIV                                              ~9      $8, 1024
         10        DIV                                              ~10     ~9, 1024
         11        SEND_VAL                                                 ~10
         12        DO_ICALL                                                 
   23    13        NEW                                              $12     'Node'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !0, $12
   24    16        ASSIGN                                                   !1, 0
         17      > JMP                                                      ->43
   25    18    >   NEW                                              $16     'Node'
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !2, $16
   26    22        ASSIGN                                                   !3, 0
         23      > JMP                                                      ->39
   27    24    >   NEW                                              $20     'Node'
         25        SEND_VAR_EX                                              !2
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !4, $20
   28    28        ASSIGN                                                   !5, 0
         29      > JMP                                                      ->35
   29    30    >   NEW                                              $24     'Node'
         31        SEND_VAR_EX                                              !4
         32        DO_FCALL                                      0          
         33        ASSIGN                                                   !6, $24
   28    34        PRE_INC                                                  !5
         35    >   FETCH_CONSTANT                                   ~28     'MAX'
         36        IS_SMALLER                                               !5, ~28
         37      > JMPNZ                                                    ~29, ->30
   26    38    >   PRE_INC                                                  !3
         39    >   FETCH_CONSTANT                                   ~31     'MAX'
         40        IS_SMALLER                                               !3, ~31
         41      > JMPNZ                                                    ~32, ->24
   24    42    >   PRE_INC                                                  !1
         43    >   FETCH_CONSTANT                                   ~34     'MAX'
         44        IS_SMALLER                                               !1, ~34
         45      > JMPNZ                                                    ~35, ->18
   33    46    >   INIT_FCALL                                               'printf'
         47        SEND_VAL                                                 '+%256.2fMB%0A'
         48        INIT_FCALL                                               'memory_get_usage'
         49        DO_ICALL                                         $36     
         50        DIV                                              ~37     $36, 1024
         51        DIV                                              ~38     ~37, 1024
         52        SEND_VAL                                                 ~38
         53        DO_ICALL                                                 
   21    54    > > JMPNZ                                                    <true>, ->5
   34    55    > > RETURN                                                   1

Class Node:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/2FkDf
function name:  __construct
number of ops:  11
compiled vars:  !0 = $parent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      null
    8     1      > JMPZ                                                     !0, ->6
    9     2    >   FETCH_THIS                                       ~3      
          3        FETCH_OBJ_W                                      $1      !0, 'childs'
          4        ASSIGN_DIM                                               $1
          5        OP_DATA                                                  ~3
   11     6    >   FETCH_THIS                                       ~6      
          7        FETCH_OBJ_W                                      $4      'childs'
          8        ASSIGN_DIM                                               $4
          9        OP_DATA                                                  ~6
   12    10      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2FkDf
function name:  __destruct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN_OBJ                                               'childs'
          1        OP_DATA                                                  null
   16     2      > RETURN                                                   null

End of function __destruct

End of class Node.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.36 ms | 1404 KiB | 19 Q