3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_objects() { $array = array(); for ($i=0; $i<5000; $i++) { $object = new stdClass(); $object->a = rand(); $object->b = rand(); $object->c = rand(); $object->d = rand(); $object->e = rand(); $array[] = $object; } return $array; } $results = array(); for ($i=0; $i<30; $i++) { $results = get_objects(); echo memory_get_usage(true) . "\n"; // assigning empty array fixes the problem // $results = array(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 3
Branch analysis from position: 14
Branch analysis from position: 3
filename:       /in/5q6ut
function name:  (null)
number of ops:  15
compiled vars:  !0 = $results, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   22     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->12
   23     3    >   INIT_FCALL                                               'get_objects'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !0, $4
   24     6        INIT_FCALL                                               'memory_get_usage'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $6      
          9        CONCAT                                           ~7      $6, '%0A'
         10        ECHO                                                     ~7
   22    11        PRE_INC                                                  !1
         12    >   IS_SMALLER                                               !1, 30
         13      > JMPNZ                                                    ~9, ->3
   28    14    > > RETURN                                                   1

Function get_objects:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 3
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 3
Branch analysis from position: 31
Branch analysis from position: 3
filename:       /in/5q6ut
function name:  get_objects
number of ops:  33
compiled vars:  !0 = $array, !1 = $i, !2 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->29
    7     3    >   NEW                                              $5      'stdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $5
    8     6        INIT_FCALL                                               'rand'
          7        DO_ICALL                                         $9      
          8        ASSIGN_OBJ                                               !2, 'a'
          9        OP_DATA                                                  $9
    9    10        INIT_FCALL                                               'rand'
         11        DO_ICALL                                         $11     
         12        ASSIGN_OBJ                                               !2, 'b'
         13        OP_DATA                                                  $11
   10    14        INIT_FCALL                                               'rand'
         15        DO_ICALL                                         $13     
         16        ASSIGN_OBJ                                               !2, 'c'
         17        OP_DATA                                                  $13
   11    18        INIT_FCALL                                               'rand'
         19        DO_ICALL                                         $15     
         20        ASSIGN_OBJ                                               !2, 'd'
         21        OP_DATA                                                  $15
   12    22        INIT_FCALL                                               'rand'
         23        DO_ICALL                                         $17     
         24        ASSIGN_OBJ                                               !2, 'e'
         25        OP_DATA                                                  $17
   14    26        ASSIGN_DIM                                               !0
         27        OP_DATA                                                  !2
    6    28        PRE_INC                                                  !1
         29    >   IS_SMALLER                                               !1, 5000
         30      > JMPNZ                                                    ~20, ->3
   17    31    > > RETURN                                                   !0
   18    32*     > RETURN                                                   null

End of function get_objects

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.3 ms | 1006 KiB | 16 Q