Reply to Re: Array Processing

Your name:

Reply:


Posted by Oli Filth on 11/05/43 11:41

J Huntley Palmer said the following on 03/03/2006 17:43:
> How may I concatenate the index respective questions and answers into
> one string per index using ONE foreach loop? I do not want to use
> numerical indexes just the named ones as below.
>
> In other words, in one foreach loop, if possible, I want to have the
> results as question0+answer0 and question1+answer1 in 2 separate
> strings entered into an array.
>
> Thanks much.
>
> Array
> (
> [0] => Array
> (
> [0] => question0
> [1] => question1
> )
>
> [QUEST] => Array
> (
> [0] => question0
> [1] => question1
> )
>
> [ANSW] => Array
> (
> [0] => answer0
> [1] => answer1
> )
>
> [1] => Array
> (
> [0] => answer0
> [1] => answer1
> )
>
> )

$stuff = array("QUEST" => array(0 => "question0", 1 => "question1"),
"ANSW" => array(0 => "answer0", 1 => "answer1"));


$strings = null;
foreach ($stuff["QUEST"] as $key => $value)
{
$strings[$key] = $value . $stuff["ANSW"][$key];
}



--
Oli

[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

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