note 88997 deleted from function.preg-replace by cmb

From: Date: Sun, 22 Sep 2019 07:59:19 +0000
Subject: note 88997 deleted from function.preg-replace by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212300@lists.php.net to get a copy of this message
Note Submitter: akam AT akameng DOT com ---- <?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..

« previous php.notes (#212300) next »