Re: array within array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On p, 2007-02-09 at 09:24 +0200, Steven Macintyre wrote:
> Hi all,
> 
> I have an array ($articles) that contains content in this format
> 
> Text<br>
> More text
> 
> I am currently calling the creation of the array as such;
> 
> $articles = split("Section break", $mystring); <-- this works
> 
> NOW ... I need to split each item in the articles array into its own array
> (newsarray)
> 
> I have tried 
> 
> Foreach ($articles as $value) {
> 	$newsarray = split("<br", $value);
> }

I'm not sure what you mean by "this aint working" but if you want all
elements of the $articles array to be arrays created by the split()
call, then try using the following:


foreach ($articles as $key => $value) {
	$newsarray = split("<br>", $value);
	$articles[$key] = $newsarray;
}

hope that helps
Zoltán Németh

> 
> But this aint working ... 
> 
> Can someone offer a better suggestion?
> 
> S
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux