note 70887 added to function.base64-decode

From: Date: Thu, 02 Nov 2006 18:47:56 +0000
Subject: note 70887 added to function.base64-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-119321@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/70887 Del: integrated -- https://master.php.net/note/delete/70887/integrated Del: useless -- https://master.php.net/note/delete/70887/useless Del: bad code -- https://master.php.net/note/delete/70887/bad+code Del: spam -- https://master.php.net/note/delete/70887/spam Del: non-english -- https://master.php.net/note/delete/70887/non-english Del: in docs -- https://master.php.net/note/delete/70887/in+docs Del: other reasons-- https://master.php.net/note/delete/70887 Reject -- https://master.php.net/note/reject/70887 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119321) next »