3v4l.org

run code in 500+ PHP versions simultaneously
<?php ini_set('memory_limit', '512M'); echo "Memory limit: ", ini_get('memory_limit'), "\n\n"; $finfo = new finfo(FILEINFO_MIME_TYPE); $minSize = 128 * 1024; $maxSize = 16 * 1024 * 1024; for($size = $minSize; $size <= $maxSize; $size *= 2) { $file = tempnam('/tmp', 'finfo'); file_put_contents($file, str_repeat('0', $size)); echo "Content size: ", number_format(filesize($file)/1024/1024, 1), "M\n"; $finfo->file($file); echo "Peak memory usage: ", number_format(memory_get_peak_usage(true)/1024/1024, 1), "M\n\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 18
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 18
Branch analysis from position: 61
Branch analysis from position: 18
filename:       /in/M3YLG
function name:  (null)
number of ops:  62
compiled vars:  !0 = $finfo, !1 = $minSize, !2 = $maxSize, !3 = $size, !4 = $file
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'ini_set'
          1        SEND_VAL                                                     'memory_limit'
          2        SEND_VAL                                                     '512M'
          3        DO_ICALL                                                     
    4     4        ECHO                                                         'Memory+limit%3A+'
          5        INIT_FCALL                                                   'ini_get'
          6        SEND_VAL                                                     'memory_limit'
          7        DO_ICALL                                             $6      
          8        ECHO                                                         $6
          9        ECHO                                                         '%0A%0A'
    6    10        NEW                                                  $7      'finfo'
         11        SEND_VAL_EX                                                  16
         12        DO_FCALL                                          0          
         13        ASSIGN                                                       !0, $7
    7    14        ASSIGN                                                       !1, 131072
    8    15        ASSIGN                                                       !2, 16777216
    9    16        ASSIGN                                                       !3, !1
         17      > JMP                                                          ->59
   10    18    >   INIT_FCALL                                                   'tempnam'
         19        SEND_VAL                                                     '%2Ftmp'
         20        SEND_VAL                                                     'finfo'
         21        DO_ICALL                                             $13     
         22        ASSIGN                                                       !4, $13
   11    23        INIT_FCALL                                                   'file_put_contents'
         24        SEND_VAR                                                     !4
         25        INIT_FCALL                                                   'str_repeat'
         26        SEND_VAL                                                     '0'
         27        SEND_VAR                                                     !3
         28        DO_ICALL                                             $15     
         29        SEND_VAR                                                     $15
         30        DO_ICALL                                                     
   12    31        ECHO                                                         'Content+size%3A+'
         32        INIT_FCALL                                                   'number_format'
         33        INIT_FCALL                                                   'filesize'
         34        SEND_VAR                                                     !4
         35        DO_ICALL                                             $17     
         36        DIV                                                  ~18     $17, 1024
         37        DIV                                                  ~19     ~18, 1024
         38        SEND_VAL                                                     ~19
         39        SEND_VAL                                                     1
         40        DO_ICALL                                             $20     
         41        ECHO                                                         $20
         42        ECHO                                                         'M%0A'
   15    43        INIT_METHOD_CALL                                             !0, 'file'
         44        SEND_VAR_EX                                                  !4
         45        DO_FCALL                                          0          
   16    46        ECHO                                                         'Peak+memory+usage%3A+'
         47        INIT_FCALL                                                   'number_format'
         48        INIT_FCALL                                                   'memory_get_peak_usage'
         49        SEND_VAL                                                     <true>
         50        DO_ICALL                                             $22     
         51        DIV                                                  ~23     $22, 1024
         52        DIV                                                  ~24     ~23, 1024
         53        SEND_VAL                                                     ~24
         54        SEND_VAL                                                     1
         55        DO_ICALL                                             $25     
         56        ECHO                                                         $25
         57        ECHO                                                         'M%0A%0A'
    9    58        ASSIGN_OP                                         3          !3, 2
         59    >   IS_SMALLER_OR_EQUAL                                          !3, !2
         60      > JMPNZ                                                        ~27, ->18
   17    61    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.42 ms | 2155 KiB | 21 Q