3v4l.org

run code in 500+ PHP versions simultaneously
<?php gc_enable(); $arr = new SplFixedArray(5000); getMemory(); for ($i = 0; $i < 5000; $i++) { $d = str_repeat("Hello, world!", 400); $arr[$i][] = $d; } unset($arr); gc_collect_cycles(); getMemory(); function getMemory() { echo date("Y-m-d H:i:s") . ' :: ' . round( (memory_get_usage(true) / 1000000), 2 ) . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
Branch analysis from position: 10
filename:       /in/RuH4Q
function name:  (null)
number of ops:  27
compiled vars:  !0 = $arr, !1 = $i, !2 = $d
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                                   'gc_enable'
          1        DO_ICALL                                                     
    3     2        NEW                                                  $4      'SplFixedArray'
          3        SEND_VAL_EX                                                  5000
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !0, $4
    4     6        INIT_FCALL_BY_NAME                                           'getMemory'
          7        DO_FCALL                                          0          
    5     8        ASSIGN                                                       !1, 0
          9      > JMP                                                          ->19
    6    10    >   INIT_FCALL                                                   'str_repeat'
         11        SEND_VAL                                                     'Hello%2C+world%21'
         12        SEND_VAL                                                     400
         13        DO_ICALL                                             $9      
         14        ASSIGN                                                       !2, $9
    7    15        FETCH_DIM_W                                          $11     !0, !1
         16        ASSIGN_DIM                                                   $11
         17        OP_DATA                                                      !2
    5    18        PRE_INC                                                      !1
         19    >   IS_SMALLER                                                   !1, 5000
         20      > JMPNZ                                                        ~14, ->10
   10    21    >   UNSET_CV                                                     !0
   11    22        INIT_FCALL                                                   'gc_collect_cycles'
         23        DO_ICALL                                                     
   12    24        INIT_FCALL_BY_NAME                                           'getMemory'
         25        DO_FCALL                                          0          
   19    26      > RETURN                                                       1

Function getmemory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RuH4Q
function name:  getMemory
number of ops:  16
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                                   'date'
          1        SEND_VAL                                                     'Y-m-d+H%3Ai%3As'
          2        DO_ICALL                                             $0      
          3        CONCAT                                               ~1      $0, '+%3A%3A+'
          4        INIT_FCALL                                                   'round'
   16     5        INIT_FCALL                                                   'memory_get_usage'
          6        SEND_VAL                                                     <true>
          7        DO_ICALL                                             $2      
          8        DIV                                                  ~3      $2, 1000000
          9        SEND_VAL                                                     ~3
   17    10        SEND_VAL                                                     2
   15    11        DO_ICALL                                             $4      
   17    12        CONCAT                                               ~5      ~1, $4
   18    13        CONCAT                                               ~6      ~5, '%0A'
         14        ECHO                                                         ~6
   19    15      > RETURN                                                       null

End of function getmemory

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
129.52 ms | 489 KiB | 13 Q