Remove special character in php.
You have a website and in that website you have lot of form for user. user fill many data via that forms. some time user feed special characters that are unreadable. so how to remove that special characters before inserting in data base? here is the few lines of code that will do it.
<?php
$input = "Fóø Bår this is the php form data ?A?B?C?D //\\?......!@#$%^&*()_ +"; // input text
$output = iconv("utf-8", "ascii//TRANSLIT//IGNORE", $input);
$output = preg_replace("/^'|[^A-Za-z0-9\ s-]|'$/", '', $output); // Remove utf-8 special characters except blank spaces
echo $output; // Results
?>
You have a website and in that website you have lot of form for user. user fill many data via that forms. some time user feed special characters that are unreadable. so how to remove that special characters before inserting in data base? here is the few lines of code that will do it.
<?php
$input = "Fóø Bår this is the php form data ?A?B?C?D //\\?......!@#$%^&*()_
$output = iconv("utf-8", "ascii//TRANSLIT//IGNORE", $input);
$output = preg_replace("/^'|[^A-Za-z0-9\
echo $output; // Results
?>
this is good i like it very much
ReplyDeletehow-to-install-ssl-certificate-in-website
how-to-start-laravel-framework