3v4l.org

run code in 300+ PHP versions simultaneously
<?php gc_enable(); class x { public $value; public function __construct($value) { $this->value = $value; } public function __unset($arg){ echo "Working"; unset($this->value); } } $array = array(); for($i = 0; $i < 50000; $i++) { $array[] = md5('Hallo'); } $x = new x($array); var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n"; unset($array); unset($x); var_dump(number_format(memory_get_usage(), 0, ',', '.')) . "\n"; var_dump(number_format(memory_get_usage(true), 0,',','.')) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 5
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 5
Branch analysis from position: 13
Branch analysis from position: 5
filename:       /in/mDHr0
function name:  (null)
number of ops:  74
compiled vars:  !0 = $array, !1 = $i, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'gc_enable'
          1        DO_ICALL                                                 
   17     2        ASSIGN                                                   !0, <array>
   18     3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->11
   19     5    >   INIT_FCALL                                               'md5'
          6        SEND_VAL                                                 'Hallo'
          7        DO_ICALL                                         $7      
          8        ASSIGN_DIM                                               !0
          9        OP_DATA                                                  $7
   18    10        PRE_INC                                                  !1
         11    >   IS_SMALLER                                               !1, 50000
         12      > JMPNZ                                                    ~9, ->5
   21    13    >   NEW                                              $10     'x'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $10
   23    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'number_format'
         19        INIT_FCALL                                               'memory_get_usage'
         20        DO_ICALL                                         $13     
         21        SEND_VAR                                                 $13
         22        SEND_VAL                                                 0
         23        SEND_VAL                                                 '%2C'
         24        SEND_VAL                                                 '.'
         25        DO_ICALL                                         $14     
         26        SEND_VAR                                                 $14
         27        DO_ICALL                                         $15     
         28        CONCAT                                           ~16     $15, '%0A'
         29        FREE                                                     ~16
   24    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'number_format'
         32        INIT_FCALL                                               'memory_get_usage'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $17     
         35        SEND_VAR                                                 $17
         36        SEND_VAL                                                 0
         37        SEND_VAL                                                 '%2C'
         38        SEND_VAL                                                 '.'
         39        DO_ICALL                                         $18     
         40        SEND_VAR                                                 $18
         41        DO_ICALL                                         $19     
         42        CONCAT                                           ~20     $19, '%0A'
         43        FREE                                                     ~20
   26    44        UNSET_CV                                                 !0
   27    45        UNSET_CV                                                 !2
   29    46        INIT_FCALL                                               'var_dump'
         47        INIT_FCALL                                               'number_format'
         48        INIT_FCALL                                               'memory_get_usage'
         49        DO_ICALL                                         $21     
         50        SEND_VAR                                                 $21
         51        SEND_VAL                                                 0
         52        SEND_VAL                                                 '%2C'
         53        SEND_VAL                                                 '.'
         54        DO_ICALL                                         $22     
         55        SEND_VAR                                                 $22
         56        DO_ICALL                                         $23     
         57        CONCAT                                           ~24     $23, '%0A'
         58        FREE                                                     ~24
   30    59        INIT_FCALL                                               'var_dump'
         60        INIT_FCALL                                               'number_format'
         61        INIT_FCALL                                               'memory_get_usage'
         62        SEND_VAL                                                 <true>
         63        DO_ICALL                                         $25     
         64        SEND_VAR                                                 $25
         65        SEND_VAL                                                 0
         66        SEND_VAL                                                 '%2C'
         67        SEND_VAL                                                 '.'
         68        DO_ICALL                                         $26     
         69        SEND_VAR                                                 $26
         70        DO_ICALL                                         $27     
         71        CONCAT                                           ~28     $27, '%0A'
         72        FREE                                                     ~28
         73      > RETURN                                                   1

Class x:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mDHr0
function name:  __construct
number of ops:  4
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'value'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function __construct

Function __unset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mDHr0
function name:  __unset
number of ops:  4
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ECHO                                                     'Working'
   13     2        UNSET_OBJ                                                'value'
   14     3      > RETURN                                                   null

End of function __unset

End of class x.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.54 ms | 1404 KiB | 23 Q