note 70888 deleted from function.base64-decode by nlopess

From: Date: Thu, 02 Nov 2006 19:56:32 +0000
Subject: note 70888 deleted from function.base64-decode by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119324@lists.php.net to get a copy of this message
Note Submitter: Matthew Pietz ---- Here is a set of functions to help get around the string length limitation in some version of PHP. <?php function my_encode($string) { if (strlen($string) > 2048) $cypher = str_split($string,2048); else $cypher = array($string); $ret = array_map('base64_encode',$cypher); return $ret; } function my_decode($array) { $ret = array_map('base64_decode',$array); return implode($ret); } ?> Note that my_encode() returns an array, you must keep it that way because my_decode() will take the array and make it a string again. When used with serialize(), you are able to serialize and send really large data. To do that, create a series of hidden inputs that will maintain the encoded array. <input type="hidden" name="object[]" value="%s"/>

« previous php.notes (#119324) next »