3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sanitizeFileName( $name ) { $invalidCharacters = array("\x2f", "\x22", "\x2a", "\x3a", "\x3c", "\x3e", "\x3f", "\x5c", "\x7f"); $name = str_replace($invalidCharacters, '', $name); $name = preg_replace('/[\x{0000}-\x{001F}]/u', '', $name); $name = preg_replace('/[\x{0080}-\x{009F}]/u', '', $name); $name = preg_replace('/[\x{E000}-\x{F8FF}]/u', '', $name); $name = preg_replace('/[\x{FDD0}-\x{FDEF}]/u', '', $name); $name = preg_replace('/[\x{FFF0}-\x{FFFF}]/u', '', $name); return $name; } echo sanitizeFileName('blablabla ǹéñ~#><'."\x{E001}");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7QTnB
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'sanitizefilename'
          1        SEND_VAL                                                 'blablabla+%C7%B9%C3%A9%C3%B1%7E%23%3E%3C%5Cx%7BE001%7D'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function sanitizefilename:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7QTnB
function name:  sanitizeFileName
number of ops:  40
compiled vars:  !0 = $name, !1 = $invalidCharacters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, <array>
    4     2        INIT_FCALL                                               'str_replace'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !0, $3
    5     8        INIT_FCALL                                               'preg_replace'
          9        SEND_VAL                                                 '%2F%5B%5Cx%7B0000%7D-%5Cx%7B001F%7D%5D%2Fu'
         10        SEND_VAL                                                 ''
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $5      
         13        ASSIGN                                                   !0, $5
    6    14        INIT_FCALL                                               'preg_replace'
         15        SEND_VAL                                                 '%2F%5B%5Cx%7B0080%7D-%5Cx%7B009F%7D%5D%2Fu'
         16        SEND_VAL                                                 ''
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $7      
         19        ASSIGN                                                   !0, $7
    7    20        INIT_FCALL                                               'preg_replace'
         21        SEND_VAL                                                 '%2F%5B%5Cx%7BE000%7D-%5Cx%7BF8FF%7D%5D%2Fu'
         22        SEND_VAL                                                 ''
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $9      
         25        ASSIGN                                                   !0, $9
    8    26        INIT_FCALL                                               'preg_replace'
         27        SEND_VAL                                                 '%2F%5B%5Cx%7BFDD0%7D-%5Cx%7BFDEF%7D%5D%2Fu'
         28        SEND_VAL                                                 ''
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                         $11     
         31        ASSIGN                                                   !0, $11
    9    32        INIT_FCALL                                               'preg_replace'
         33        SEND_VAL                                                 '%2F%5B%5Cx%7BFFF0%7D-%5Cx%7BFFFF%7D%5D%2Fu'
         34        SEND_VAL                                                 ''
         35        SEND_VAR                                                 !0
         36        DO_ICALL                                         $13     
         37        ASSIGN                                                   !0, $13
   11    38      > RETURN                                                   !0
   12    39*     > RETURN                                                   null

End of function sanitizefilename

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.6 ms | 1403 KiB | 18 Q