3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isValidFileName($fileName) { if(!preg_match('/(^[a-zA-Z0-9\.\-\s_]+)\.(jpg|gif|png|bmp)$/i', $fileName)) { return false; } return true; } echo (isValidFileName("file1.jpg"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mWTKZ
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'isvalidfilename'
          1        SEND_VAL                                                 'file1.jpg'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function isvalidfilename:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mWTKZ
function name:  isValidFileName
number of ops:  10
compiled vars:  !0 = $fileName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%28%5E%5Ba-zA-Z0-9%5C.%5C-%5Cs_%5D%2B%29%5C.%28jpg%7Cgif%7Cpng%7Cbmp%29%24%2Fi'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        BOOL_NOT                                         ~2      $1
          6      > JMPZ                                                     ~2, ->8
    8     7    > > RETURN                                                   <false>
   12     8    > > RETURN                                                   <true>
   13     9*     > RETURN                                                   null

End of function isvalidfilename

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.63 ms | 1397 KiB | 16 Q