what characters can not be used in file names? [duplicate]

0

We know that it is common to use systems that save files, would you like to know which characters are invalid to be used as filenames? is there a function that removes all non-letter characters?

    
asked by anonymous 24.01.2018 / 18:26

1 answer

2

When creating a file or folder on your computer, there are some characters that you are not allowed to use in their names.

Check out what they are:

\
/
|
<
>
*
:
“

Valid characters for naming files or folders include all alphabet letters (A through Z) and numbers (from 0 to 9), as well as special characters:

^ 
& 
‘ 
@ 
{ 
} 
[ 
] 
, 
$ 
= 
! 
– 
# 
( 
) 
% 
. 
+ 
~ 
_ 

Source: link

About the function, see this question of another user.

$callback = function ($value) {
    return preg_replace('/\W+/u', '', $value);
};

array_map($callback, $array);
    
24.01.2018 / 18:28