You are here: Re: How to move arrays from html webpage to webpage? « PHP Programming Language « IT news, forums, messages
Re: How to move arrays from html webpage to webpage?

Posted by Sanders Kaufman on 01/16/07 07:08

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?
>
> Firstly, there's no such function as "compress". I'd assumed you'd meant
> "implode" which is the counterpart of "explode".


Yeah - that's what I meant :)



>
> <?php
>
> $orig = array('foo', 'bar', 'baz');
> print "Original:\n"; var_dump($orig);
> $imploded = implode(':', $orig);
> $serialized = serialize($orig);
> print "Imploded is '$imploded'.\n";
> print "Serialized is '$serialized'.\n";
> $exploded = explode(':', $imploded);
> $unserialized = unserialize($serialized);
> print "Exploded:\n"; var_dump($exploded);
> print "\nUnserialized:\n"; var_dump($unserialized);
>
> print "\n\n----------------------\n\n";
>
> $orig = array('foo'=>12, 'bar'=>24, 'baz'=>18);
> print "Original:\n"; var_dump($orig);
> $imploded = implode(':', $orig);
> $serialized = serialize($orig);
> print "Imploded is '$imploded'.\n";
> print "Serialized is '$serialized'.\n";
> $exploded = explode(':', $imploded);
> $unserialized = unserialize($serialized);
> print "Exploded:\n"; var_dump($exploded);
> print "\nUnserialized:\n"; var_dump($unserialized);
>
> ?>
>

 

Navigation:

[Reply to this 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

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