3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo sprintf("\n%.1fMB", memory_get_usage(true) / 1024 / 1024); // allocate a large byte string of around 5 MB $a = str_repeat("0", 5 * 1024 * 1024); echo sprintf("\n%.1fMB", memory_get_usage(true) / 1024 / 1024); // setting the memory limit lower than the current is accepted ini_set("memory_limit", "3M"); echo sprintf("\n%.1fMB", memory_get_usage(true) / 1024 / 1024); // further allocation beyond the limit $b = str_repeat("0", 5 * 1024 * 1024); echo sprintf("\n%.1fMB", memory_get_usage(true) / 1024 / 1024);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/egq60
function name:  (null)
number of ops:  55
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'sprintf'
          1        SEND_VAL                                                 '%0A%25.1fMB'
          2        INIT_FCALL                                               'memory_get_usage'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $2      
          5        DIV                                              ~3      $2, 1024
          6        DIV                                              ~4      ~3, 1024
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                         $5      
          9        ECHO                                                     $5
    5    10        INIT_FCALL                                               'str_repeat'
         11        SEND_VAL                                                 '0'
         12        SEND_VAL                                                 5242880
         13        DO_ICALL                                         $6      
         14        ASSIGN                                                   !0, $6
    6    15        INIT_FCALL                                               'sprintf'
         16        SEND_VAL                                                 '%0A%25.1fMB'
         17        INIT_FCALL                                               'memory_get_usage'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $8      
         20        DIV                                              ~9      $8, 1024
         21        DIV                                              ~10     ~9, 1024
         22        SEND_VAL                                                 ~10
         23        DO_ICALL                                         $11     
         24        ECHO                                                     $11
    9    25        INIT_FCALL                                               'ini_set'
         26        SEND_VAL                                                 'memory_limit'
         27        SEND_VAL                                                 '3M'
         28        DO_ICALL                                                 
   10    29        INIT_FCALL                                               'sprintf'
         30        SEND_VAL                                                 '%0A%25.1fMB'
         31        INIT_FCALL                                               'memory_get_usage'
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $13     
         34        DIV                                              ~14     $13, 1024
         35        DIV                                              ~15     ~14, 1024
         36        SEND_VAL                                                 ~15
         37        DO_ICALL                                         $16     
         38        ECHO                                                     $16
   13    39        INIT_FCALL                                               'str_repeat'
         40        SEND_VAL                                                 '0'
         41        SEND_VAL                                                 5242880
         42        DO_ICALL                                         $17     
         43        ASSIGN                                                   !1, $17
   14    44        INIT_FCALL                                               'sprintf'
         45        SEND_VAL                                                 '%0A%25.1fMB'
         46        INIT_FCALL                                               'memory_get_usage'
         47        SEND_VAL                                                 <true>
         48        DO_ICALL                                         $19     
         49        DIV                                              ~20     $19, 1024
         50        DIV                                              ~21     ~20, 1024
         51        SEND_VAL                                                 ~21
         52        DO_ICALL                                         $22     
         53        ECHO                                                     $22
         54      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
13.47 ms | 467 KiB | 7 Q