Reply to Re: combining serialized data

Your name:

Reply:


Posted by jmark on 05/17/07 12:00

On May 16, 3:06 pm, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote:
> I have some data I want to serialize but I want to combine them.
>
> something like
> serialize($data1).serialize($data2)
>
> and then later on I need to deserialize them back into two seperate
> variables. I'm not sure how I can go about this? Obviously I could seperate
> them by some token and use that but I'm not sure how safe it is. Is there a
> better method? or a token that I know I can used.
>
> I guess I could do something like this
>
> $str = serialize(array(serialize($data1), serialize($data2)))
>
> then
> $t = unserialize($str);
> $data1 = unserialize($t[0]);
> $data2 = unserialize($t[1]);
>
> but seems like the long way around?
>
> Thanks,
> Jon

You can simply make one array and serialize it
$combinedData = array($data1, $data2);
serialize($combinedData)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация