Reply to Re: How to move arrays from html webpage to webpage?

Your name:

Reply:


Posted by Kimmo Laine on 01/16/07 07:10

"Sanders Kaufman" <bucky@kaufman.net> wrote in message
news:otSqh.20353$yC5.3398@newssvr27.news.prodigy.net...
> Toby Inkster wrote:
>> Sanders Kaufman wrote:
>>
>>> You could use the "explode" and "compress" array functions in PHP.
>>
>> serialize() and unserialize() would probably be better choices.
>
>
> I thought those were the same thing.
> What's the difference?


$original = array('foo'=>'bar;zap');
print_r($original);
print_r(unserialize(serialize($original)));
print_r(explode(';', implode(';', $original)));

Differences when using explode/implode:
- keys are lost
- if a string value happens to have the split/glue character, it totally
messes up the array

serialize/unserialize preserves the array structure better. Implode and
explode aren't completely useless, on a special occasion they work just
fine, still serialize/unserialize is more stable solution.

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)

[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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация