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+/', ..."
 
Line 1: Line 1:
==Windows Safe directory name==
==Windows Safe directory name==


<script lang="php">
<source lang="php">
function safename($d){
function safename($d){
         $d = preg_replace('|[\/\?<>\\\\:*\|"\(\)]|i', ' ', $d);
         $d = preg_replace('|[\/\?<>\\\\:*\|"\(\)]|i', ' ', $d);

Revision as of 15:06, 11 June 2013

Windows Safe directory name

<source lang="php"> function safename($d){

       $d = preg_replace('|[\/\?<>\\\\:*\|"\(\)]|i', ' ', $d);
       $d = preg_replace('/\s+/', ' ', $d);
       return trim($d);

} </script>