Remove special characters from file name


/ Published in: PHP
Save to your folder(s)

The special characters in the file name caused problem when the exported to iphone application.


Copy this code and paste it in your HTML
  1. function remove_special_char($string) {
  2. $ts = array("/\~/", "/\`/", "/\@/", "/\#/", "/\\$/", "/\%/", "/\^/", "/\&/", "/\*/", "/\(/", "/\)/", "/\:/", "/\:/", "/\;/", "/\</", "/\>/", "/\?/", "/\//", "/\,/", "/\{/", "/\}/", "/\[/", "/\]/", "/\|/", "/\+/", "/\=/", "/\!/", "/\'/" );
  3. $string = preg_replace($ts,'', $string);
  4. return $string;
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.