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?
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?
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);