note 88997 added to function.preg-replace
| From: | akamATakamengDOTcom at osu1 dot php dot net | Date: | Wed, 18 Feb 2009 00:02:58 +0000 |
| Subject: | note 88997 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150766@lists.php.net to get a copy of this message | ||
<?php
$converted =
array(
//3 of special chars
'/(;)/ie',
'/(#)/ie',
'/(&)/ie',
//MySQL reserved words!
//Check mysql website!
'/(ACTION)/ie', '/(ADD)/ie', '/(ALL)/ie', '/(ALTER)/ie',
'/(ANALYZE)/ie', '/(AND)/ie', '/(AS)/ie', '/(ASC)/ie',
//remaining of special chars
'/(<)/ie', '/(>)/ie', '/(\.)/ie', '/(,)/ie',
'/(\?)/ie', '/(`)/ie', '/(!)/ie', '/(@)/ie',
'/(\$)/ie', '/(%)/ie', '/(\^)/ie', '/(\*)/ie',
'/(\()/ie', '/(\))/ie', '/(_)/ie', '/(-)/ie',
'/(\+)/ie',
'/(=)/ie', '/(\/)/ie', '/(\|)/ie', '/(\\\)/ie',
"/(')/ie", '/(")/ie', '/(:)/'
);
$input_text = preg_replace($converted, "UTF_to_Unicode('\\1')", $text);
function UTF_to_Unicode($data){
//return $data;
}
?>
The above example useful for filtering input data, then saving into mysql database, it's not
need tobe decoded again, just use UTF-8 as charset.
Please Note escaping special chars between delimiter..
----
Server IP: 69.147.83.197
Probable Submitter: 67.228.101.165
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/88997
Del: integrated -- https://master.php.net/note/delete/88997/integrated
Del: useless -- https://master.php.net/note/delete/88997/useless
Del: bad code -- https://master.php.net/note/delete/88997/bad+code
Del: spam -- https://master.php.net/note/delete/88997/spam
Del: non-english -- https://master.php.net/note/delete/88997/non-english
Del: in docs -- https://master.php.net/note/delete/88997/in+docs
Del: other reasons-- https://master.php.net/note/delete/88997
Reject -- https://master.php.net/note/reject/88997
Search -- https://master.php.net/manage/user-notes.php