3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * test that filemtime() returns Unix timestamp (UTC) on current system */ $timestampStartOfUnixEpoch = 0; // start of the Unix epoch. $timestampRequest = 3600 * (int) ($_SERVER['REQUEST_TIME'] / 3600); $testFile = tempnam(sys_get_temp_dir(), 'test-dropbox-uploader'); printf("PHP version is %s.\n", PHP_VERSION); printf("Testfile is '%s'.\n", $testFile); touch($testFile, $timestampStartOfUnixEpoch); clearstatcache(false, $testFile); $mtime = filemtime($testFile); printf("Testfile '%s' mtime should be from touch %d, is %d.\n", basename($testFile), $timestampStartOfUnixEpoch, $mtime); printf("The mtime represents %s\n", date('r', $mtime)); touch($testFile, $timestampRequest); clearstatcache(false, $testFile); $mtime = filemtime($testFile); printf("Testfile '%s' mtime should be from touch %d, is %d.\n", basename($testFile), $timestampRequest, $mtime); printf("The mtime represents %s\n", date('r', $mtime)); unlink($testFile);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QiqFD
function name:  (null)
number of ops:  84
compiled vars:  !0 = $timestampStartOfUnixEpoch, !1 = $timestampRequest, !2 = $testFile, !3 = $mtime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, 0
    7     1        FETCH_R                      global              ~5      '_SERVER'
          2        FETCH_DIM_R                                      ~6      ~5, 'REQUEST_TIME'
          3        DIV                                              ~7      ~6, 3600
          4        CAST                                          4  ~8      ~7
          5        MUL                                              ~9      ~8, 3600
          6        ASSIGN                                                   !1, ~9
    9     7        INIT_FCALL                                               'tempnam'
          8        INIT_FCALL                                               'sys_get_temp_dir'
          9        DO_ICALL                                         $11     
         10        SEND_VAR                                                 $11
         11        SEND_VAL                                                 'test-dropbox-uploader'
         12        DO_ICALL                                         $12     
         13        ASSIGN                                                   !2, $12
   11    14        INIT_FCALL                                               'printf'
         15        SEND_VAL                                                 'PHP+version+is+%25s.%0A'
         16        SEND_VAL                                                 '8.0.0'
         17        DO_ICALL                                                 
   12    18        INIT_FCALL                                               'printf'
         19        SEND_VAL                                                 'Testfile+is+%27%25s%27.%0A'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
   14    22        INIT_FCALL                                               'touch'
         23        SEND_VAR                                                 !2
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                                 
   15    26        INIT_FCALL                                               'clearstatcache'
         27        SEND_VAL                                                 <false>
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                                 
   16    30        INIT_FCALL                                               'filemtime'
         31        SEND_VAR                                                 !2
         32        DO_ICALL                                         $18     
         33        ASSIGN                                                   !3, $18
   17    34        INIT_FCALL                                               'printf'
         35        SEND_VAL                                                 'Testfile+%27%25s%27+mtime+should+be+from+touch+%25d%2C+is+%25d.%0A'
         36        INIT_FCALL                                               'basename'
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                         $20     
         39        SEND_VAR                                                 $20
         40        SEND_VAR                                                 !0
         41        SEND_VAR                                                 !3
         42        DO_ICALL                                                 
   18    43        INIT_FCALL                                               'printf'
         44        SEND_VAL                                                 'The+mtime+represents+%25s%0A'
         45        INIT_FCALL                                               'date'
         46        SEND_VAL                                                 'r'
         47        SEND_VAR                                                 !3
         48        DO_ICALL                                         $22     
         49        SEND_VAR                                                 $22
         50        DO_ICALL                                                 
   20    51        INIT_FCALL                                               'touch'
         52        SEND_VAR                                                 !2
         53        SEND_VAR                                                 !1
         54        DO_ICALL                                                 
   21    55        INIT_FCALL                                               'clearstatcache'
         56        SEND_VAL                                                 <false>
         57        SEND_VAR                                                 !2
         58        DO_ICALL                                                 
   22    59        INIT_FCALL                                               'filemtime'
         60        SEND_VAR                                                 !2
         61        DO_ICALL                                         $26     
         62        ASSIGN                                                   !3, $26
   23    63        INIT_FCALL                                               'printf'
         64        SEND_VAL                                                 'Testfile+%27%25s%27+mtime+should+be+from+touch+%25d%2C+is+%25d.%0A'
         65        INIT_FCALL                                               'basename'
         66        SEND_VAR                                                 !2
         67        DO_ICALL                                         $28     
         68        SEND_VAR                                                 $28
         69        SEND_VAR                                                 !1
         70        SEND_VAR                                                 !3
         71        DO_ICALL                                                 
   24    72        INIT_FCALL                                               'printf'
         73        SEND_VAL                                                 'The+mtime+represents+%25s%0A'
         74        INIT_FCALL                                               'date'
         75        SEND_VAL                                                 'r'
         76        SEND_VAR                                                 !3
         77        DO_ICALL                                         $30     
         78        SEND_VAR                                                 $30
         79        DO_ICALL                                                 
   26    80        INIT_FCALL                                               'unlink'
         81        SEND_VAR                                                 !2
         82        DO_ICALL                                                 
         83      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
188.82 ms | 1400 KiB | 31 Q