You are here: Re: reading content of an array « All PHP « IT news, forums, messages
Re: reading content of an array

Posted by Rik on 08/21/06 14:14

nescio wrote:
> hello,
>
> i have two array;
>
> one is of the type:
> $a = array('a','b','c','d');
>
> i place this array in an associative array like:
>
> $b = array('some_key' => 'hello ; ' . $a);

That cannot be done, you cannot concatenate an array to a string.

> (so the value has some text then a ';' and then the array)

No, it has the text 'Array', and usually an error is logged.

Use:
$b = array('some_key' => array('text' = 'hello ;', 'array' = $a));
or perhaps:
$b = array('some_key' => array_merge(array('hello'),$a));
depending on your needs.

Then you've preserved the array.

Alternatively, you could serialize() your array, but I don't see the point.

Grtz,
--
Rik Wasmus

 

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

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