note 103446 modified in function.serialize by danbrown

From: Date: Wed, 13 Apr 2011 19:53:40 +0000
Subject: note 103446 modified in function.serialize by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178813@lists.php.net to get a copy of this message
In addition to base64_encode(), save space in the DB by compressing the serialized object. As follows: <?php mySerialize( $obj ) { return base64_encode(gzcompress(serialize($obj))); } myUnserialize( $txt ) { return unserialize(gzuncompress(base64_decode($txt))); } ?> --was-- In addition to base64_encode(), save space in the DB by compressing the serialized object. As follows: mySerialize( $obj ) { return base64_encode(gzcompress(serialize($obj))); } myUnserialize( $txt ) { return unserialize(gzuncompress(base64_decode($txt))); } http://php.net/manual/en/function.serialize.php

« previous php.notes (#178813) next »