3v4l.org

run code in 300+ PHP versions simultaneously
<?php $finfo = new finfo(FILEINFO_MIME_TYPE); $postMimeType = $finfo->buffer(file_get_contents('http://4.bp.blogspot.com/-JOqxgp-ZWe0/U3BtyEQlEiI/AAAAAAAAOfg/Doq6Q2MwIKA/s1600/google-logo-874x288.png')); // If the URL has the file extension included, this will find it $fileExtension = pathinfo($imageUrl, 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/ljKN1
function name:  (null)
number of ops:  29
compiled vars:  !0 = $finfo, !1 = $postMimeType, !2 = $fileExtension, !3 = $imageUrl, !4 = $filename
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $5      'finfo'
          1        SEND_VAL_EX                                              16
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $5
    4     4        INIT_METHOD_CALL                                         !0, 'buffer'
          5        INIT_FCALL                                               'file_get_contents'
          6        SEND_VAL                                                 'http%3A%2F%2F4.bp.blogspot.com%2F-JOqxgp-ZWe0%2FU3BtyEQlEiI%2FAAAAAAAAOfg%2FDoq6Q2MwIKA%2Fs1600%2Fgoogle-logo-874x288.png'
          7        DO_ICALL                                         $8      
          8        SEND_VAR_NO_REF_EX                                       $8
          9        DO_FCALL                                      0  $9      
         10        ASSIGN                                                   !1, $9
    7    11        INIT_FCALL                                               'pathinfo'
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 4
         14        DO_ICALL                                         $11     
         15        ASSIGN                                                   !2, $11
   11    16        IS_IDENTICAL                                             !2, ''
         17      > JMPZ                                                     ~13, ->25
   12    18    >   INIT_FCALL                                               'basename'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $14     
         21        ASSIGN                                                   !2, $14
   13    22        CONCAT                                           ~16     !4, '.'
         23        CONCAT                                           ~17     ~16, !2
         24        ASSIGN                                                   !4, ~17
   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:
163.37 ms | 1396 KiB | 21 Q