3v4l.org

run code in 300+ PHP versions simultaneously
<?php $finfo = new finfo(FILEINFO_MIME_TYPE); $postMimeType = $finfo->buffer(file_get_contents('http://google.com')); // If the URL has the file extension included, this will find it $fileExtension = pathinfo('http://google.com', PATHINFO_EXTENSION); // Otherwise, get file extension from the MIME type // This is necessary for image thumbnails to display correctly in the WordPress dashboard media section if ($fileExtension === '') { $fileExtension = basename($postMimeType); $filename = $filename . '.' . $fileExtension; } var_dump($fileExtension);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/pGBop
function name:  (null)
number of ops:  29
compiled vars:  !0 = $finfo, !1 = $postMimeType, !2 = $fileExtension, !3 = $filename
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'finfo'
          1        SEND_VAL_EX                                              16
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
    4     4        INIT_METHOD_CALL                                         !0, 'buffer'
          5        INIT_FCALL                                               'file_get_contents'
          6        SEND_VAL                                                 'http%3A%2F%2Fgoogle.com'
          7        DO_ICALL                                         $7      
          8        SEND_VAR_NO_REF_EX                                       $7
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !1, $8
    7    11        INIT_FCALL                                               'pathinfo'
         12        SEND_VAL                                                 'http%3A%2F%2Fgoogle.com'
         13        SEND_VAL                                                 4
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !2, $10
   11    16        IS_IDENTICAL                                             !2, ''
         17      > JMPZ                                                     ~12, ->25
   12    18    >   INIT_FCALL                                               'basename'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !2, $13
   13    22        CONCAT                                           ~15     !3, '.'
         23        CONCAT                                           ~16     ~15, !2
         24        ASSIGN                                                   !3, ~16
   17    25    >   INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.1 ms | 1395 KiB | 21 Q