|
Posted by Jamie Davison on 09/30/66 11:39
On 2/10/06 9:51 AM, in article
43eca863$0$82675$ed2619ec@ptn-nntp-reader03.plus.net, "mark"
<mark@localhost.net> wrote:
> I have one very large include, which is an array. It's included when
> index.php is loaded. However, I now need to use the same include on
> page2.php, and page3.php and page4.php. Is there a smart way to do this and
> mimize load times on each sudsequent page?
You could serialize (http://us2.php.net/serialize) the array and then
register the serialized array as a session variable. With every call to the
array you would then have to unserialize the object . . .
$my_object = serialize($your_very_large_array);
session_register($my_object);
. . . For subsequent pages
function unpackit($ob)
{
ret_array = unserialize($ob);
return ret_array;
}
$my_large_array = unpackit($my_object);
.. . .
Navigation:
[Reply to this message]
|