3v4l.org

run code in 500+ PHP versions simultaneously
<?php $memoryLimit = ini_get('memory_limit'); if ($memoryLimit == '-1') { // Unlimited - use a safe default (2GB) return 2 * 1024 * 1024 * 1024; } $unit = strtoupper(substr($memoryLimit, -1)); $value = (int) $memoryLimit; switch ($unit) { case 'G': $value *= 1024 * 1024 * 1024; break; case 'M': $value *= 1024 * 1024; break; case 'K': $value *= 1024; break; } echo $memoryLimit . "\n"; echo $value . "\n"; echo memory_get_usage(true);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
5 jumps found. (Code = 188) Position 1 = 22, Position 2 = 24, Position 3 = 26, Position 4 = 28, Position 5 = 15
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 28
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 26
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 26
Branch analysis from position: 24
Branch analysis from position: 22
filename:       /in/sPSa9
function name:  (null)
number of ops:  37
compiled vars:  !0 = $memoryLimit, !1 = $unit, !2 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'ini_get'
          1        SEND_VAL                                                     'memory_limit'
          2        DO_ICALL                                             $3      
          3        ASSIGN                                                       !0, $3
    5     4        IS_EQUAL                                                     !0, '-1'
          5      > JMPZ                                                         ~5, ->7
    7     6    > > RETURN                                                       2147483648
   10     7    >   INIT_FCALL                                                   'strtoupper'
          8        FRAMELESS_ICALL_2                substr              ~6      !0, -1
          9        SEND_VAL                                                     ~6
         10        DO_ICALL                                             $7      
         11        ASSIGN                                                       !1, $7
   11    12        CAST                                              4  ~9      !0
         13        ASSIGN                                                       !2, ~9
   13    14      > SWITCH_STRING                                                !1, [ 'G':->22, 'M':->24, 'K':->26, ], ->28
   14    15    >   IS_EQUAL                                                     !1, 'G'
         16      > JMPNZ                                                        ~11, ->22
   17    17    >   IS_EQUAL                                                     !1, 'M'
         18      > JMPNZ                                                        ~11, ->24
   20    19    >   IS_EQUAL                                                     !1, 'K'
         20      > JMPNZ                                                        ~11, ->26
         21    > > JMP                                                          ->28
   15    22    >   ASSIGN_OP                                         3          !2, 1073741824
   16    23      > JMP                                                          ->28
   18    24    >   ASSIGN_OP                                         3          !2, 1048576
   19    25      > JMP                                                          ->28
   21    26    >   ASSIGN_OP                                         3          !2, 1024
   22    27      > JMP                                                          ->28
   24    28    >   CONCAT                                               ~15     !0, '%0A'
         29        ECHO                                                         ~15
   25    30        CONCAT                                               ~16     !2, '%0A'
         31        ECHO                                                         ~16
   27    32        INIT_FCALL                                                   'memory_get_usage'
         33        SEND_VAL                                                     <true>
         34        DO_ICALL                                             $17     
         35        ECHO                                                         $17
         36      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.19 ms | 1387 KiB | 16 Q