PHP Tips && Tricks: Difference between revisions
From D3xt3r01.tk
Jump to navigationJump to search
Created page with "==Windows Safe directory name== <script lang="php"> function safename($d){ $d = preg_replace('|[\/\?<>\\\\:*\|"\(\)]|i', ' ', $d); $d = preg_replace('/\s+/', ..." |
mNo edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Windows Safe directory name== | ==Windows Safe directory name== | ||
< | <source lang="php"> | ||
// Windows name doen't allow the following chars: / \ ? < > : * | " | |||
function safename($d){ | function safename($d){ | ||
$d = preg_replace('|[\/\?<>\\\\:*\|" | $d = preg_replace('|[\/\?<>\\\\:*\|"]|i', ' ', $d); | ||
$d = preg_replace('/\s+/', ' ', $d); | $d = preg_replace('/\s+/', ' ', $d); | ||
return trim($d); | return trim($d); | ||
} | } | ||
</ | </source> |
Latest revision as of 15:37, 11 June 2013
Windows Safe directory name
// Windows name doen't allow the following chars: / \ ? < > : * | "
function safename($d){
$d = preg_replace('|[\/\?<>\\\\:*\|"]|i', ' ', $d);
$d = preg_replace('/\s+/', ' ', $d);
return trim($d);
}