3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NonLeakingClass { } function test(){ $ret = []; for($i=0;$i<100000;$i++){ $ret[]= new NonLeakingClass(); } return $ret; } $i=0; echo "test?".PHP_EOL; echo memory_get_usage()."\n"; while($i++<10){ if($i==1){ $a=test(); echo memory_get_usage()."\n"; unset($a); } echo memory_get_usage()."\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 7
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 7
Branch analysis from position: 24
Branch analysis from position: 7
Branch analysis from position: 17
filename:       /in/hYkfE
function name:  (null)
number of ops:  25
compiled vars:  !0 = $i, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, 0
   14     1        ECHO                                                     'test%3F%0A'
   15     2        INIT_FCALL                                               'memory_get_usage'
          3        DO_ICALL                                         $3      
          4        CONCAT                                           ~4      $3, '%0A'
          5        ECHO                                                     ~4
   16     6      > JMP                                                      ->21
   17     7    >   IS_EQUAL                                                 !0, 1
          8      > JMPZ                                                     ~5, ->17
   18     9    >   INIT_FCALL                                               'test'
         10        DO_FCALL                                      0  $6      
         11        ASSIGN                                                   !1, $6
   19    12        INIT_FCALL                                               'memory_get_usage'
         13        DO_ICALL                                         $8      
         14        CONCAT                                           ~9      $8, '%0A'
         15        ECHO                                                     ~9
   20    16        UNSET_CV                                                 !1
   22    17    >   INIT_FCALL                                               'memory_get_usage'
         18        DO_ICALL                                         $10     
         19        CONCAT                                           ~11     $10, '%0A'
         20        ECHO                                                     ~11
   16    21    >   POST_INC                                         ~12     !0
         22        IS_SMALLER                                               ~12, 10
         23      > JMPNZ                                                    ~13, ->7
   23    24    > > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/hYkfE
function name:  test
number of ops:  12
compiled vars:  !0 = $ret, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, <array>
    7     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->8
    8     3    >   NEW                                              $5      'NonLeakingClass'
          4        DO_FCALL                                      0          
          5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  $5
    7     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, 100000
          9      > JMPNZ                                                    ~8, ->3
   10    10    > > RETURN                                                   !0
   12    11*     > RETURN                                                   null

End of function test

Class NonLeakingClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.24 ms | 1402 KiB | 16 Q