note 53087 deleted from function.mysql-escape-string by danbrown
| From: | danbrown@php.net | Date: | Wed, 12 Aug 2009 21:48:57 +0000 |
| Subject: | note 53087 deleted from function.mysql-escape-string by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159409@lists.php.net to get a copy of this message | ||
Note Submitter: steve at tequilasolutions dot com
----
Rather than bin2hex use a combination of serialise and base64. Data gets 33% bigger than source but
with bin2hex data gets 90% bigger.
I have two functions for encoding and decoding data before use in sql. Using serialse preserves
the datatypes so that you can insert any data you like, arrays etc.
function enc($x){
return base64_encode(serialize($x));
}
function dec($x){
return unserialize(base64_decode($x));
}