note 70888 added to function.base64-decode
| From: | MatthewPietz at osu1 dot php dot net | Date: | Thu, 02 Nov 2006 18:47:56 +0000 |
| Subject: | note 70888 added to function.base64-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119320@lists.php.net to get a copy of this message | ||
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"/>
----
Server IP: 64.71.164.2
Probable Submitter: 198.236.64.23 (proxied: 10.104.201.155)
----
Manual Page -- http://www.php.net/manual/en/function.base64-decode.php
Edit -- https://master.php.net/note/edit/70888
Del: integrated -- https://master.php.net/note/delete/70888/integrated
Del: useless -- https://master.php.net/note/delete/70888/useless
Del: bad code -- https://master.php.net/note/delete/70888/bad+code
Del: spam -- https://master.php.net/note/delete/70888/spam
Del: non-english -- https://master.php.net/note/delete/70888/non-english
Del: in docs -- https://master.php.net/note/delete/70888/in+docs
Del: other reasons-- https://master.php.net/note/delete/70888
Reject -- https://master.php.net/note/reject/70888
Search -- https://master.php.net/manage/user-notes.php