3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A extends \stdClass { public int $i = 42; public function __unserialize($properties) { foreach ($properties as $key => $property) { $this->$key = $property; } } } $holder = []; for ($i = 0; $i < 10000; $i++) { $holder[] = new A; } var_dump(memory_get_usage()); foreach ($holder as $obj) { } var_dump(memory_get_usage()); $unserialized_holder = []; foreach ($holder as $obj) { $unserialized_holder[] = \unserialize(\serialize($obj)); } unset($holder); var_dump(memory_get_usage());
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
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 36
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 36
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
Branch analysis from position: 18
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/nhKJu
function name:  (null)
number of ops:  44
compiled vars:  !0 = $holder, !1 = $i, !2 = $obj, !3 = $unserialized_holder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->8
   12     3    >   NEW                                              $7      'A'
          4        DO_FCALL                                      0          
          5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  $7
   11     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, 10000
          9      > JMPNZ                                                    ~10, ->3
   15    10    >   INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'memory_get_usage'
         12        DO_ICALL                                         $11     
         13        SEND_VAR                                                 $11
         14        DO_ICALL                                                 
   17    15      > FE_RESET_R                                       $13     !0, ->18
         16    > > FE_FETCH_R                                               $13, !2, ->18
         17    > > JMP                                                      ->16
         18    >   FE_FREE                                                  $13
   20    19        INIT_FCALL                                               'var_dump'
         20        INIT_FCALL                                               'memory_get_usage'
         21        DO_ICALL                                         $14     
         22        SEND_VAR                                                 $14
         23        DO_ICALL                                                 
   22    24        ASSIGN                                                   !3, <array>
   23    25      > FE_RESET_R                                       $17     !0, ->36
         26    > > FE_FETCH_R                                               $17, !2, ->36
   24    27    >   INIT_FCALL                                               'unserialize'
         28        INIT_FCALL                                               'serialize'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                         $19     
         31        SEND_VAR                                                 $19
         32        DO_ICALL                                         $20     
         33        ASSIGN_DIM                                               !3
         34        OP_DATA                                                  $20
   23    35      > JMP                                                      ->26
         36    >   FE_FREE                                                  $17
   26    37        UNSET_CV                                                 !0
   28    38        INIT_FCALL                                               'var_dump'
         39        INIT_FCALL                                               'memory_get_usage'
         40        DO_ICALL                                         $21     
         41        SEND_VAR                                                 $21
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Class A:
Function __unserialize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/nhKJu
function name:  __unserialize
number of ops:  9
compiled vars:  !0 = $properties, !1 = $property, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1      > FE_RESET_R                                       $3      !0, ->7
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->7
          3    >   ASSIGN                                                   !2, ~4
    6     4        ASSIGN_OBJ                                               !2
          5        OP_DATA                                                  !1
    5     6      > JMP                                                      ->2
          7    >   FE_FREE                                                  $3
    8     8      > RETURN                                                   null

End of function __unserialize

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.55 ms | 1461 KiB | 17 Q