note 80845 added to control-structures.foreach
| From: | sorin21usatyahoodotcom at osu1 dot php dot net | Date: | Sun, 03 Feb 2008 01:50:36 +0000 |
| Subject: | note 80845 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135745@lists.php.net to get a copy of this message | ||
I put all variables into a container with border. I want to divide this container in three. Thus the
$name to be in one box in top, the $PostalAddress to be in the 2nd box in right, and the rest of the
variables to be in another box in left. I don't know how to take those variables and to put
them in those boxes, because I use a nested foreach loop and I'm not sure how to do it.
$arr1 = array('Name' =>'Bob',
'Age' =>'20',
'BirthDate' => '11-20-1980',
'HairColor' => 'Brown',
'EyeColor' => 'Hazel',
'Height' => '150',
'Weight' => '100',
'PostalAddress' => '26 East St Lebanon');
$arr2 = array('Name' =>'Mike',
'Age' =>'24',
'BirthDate' => '09-11-1989',
'HairColor' => 'Black',
'EyeColor' => 'Brown',
'Height' => '180',
'Weight' => '130',
'PostalAddress' => '12 Hold St Hanover');
$arr3= array('Name' =>'Dan',
'Age' =>'22',
'BirthDate' => '12-09-1987',
'HairColor' => 'Green',
'EyeColor' => 'Green',
'Height' => '140',
'Weight' => '100',
'PostalAddress' => '10 Brown St New York');
$arr4 = array('Name' =>'Tim',
'Age' =>'30',
'BirthDate' => '09-09-1975',
'HairColor' => 'Blonde',
'EyeColor' => 'Blue',
'Height' => '170',
'Weight' => '140',
'PostalAddress' => '14 Handle St WRJ');
$arr5 = array('Name' =>'Diana',
'Age' =>'27',
'BirthDate' => '11-08-1979',
'HairColor' => 'Blonde',
'EyeColor' => 'Green',
'Height' => '170',
'Weight' => '120',
'PostalAddress' => '22 South Main St Hanover');
$Records = array($arr1,$arr2,$arr3,$arr4,$arr5);
foreach($Records as $array)
{
print("<div id='container'>");
foreach($array as $key=>$value)
{
print("$value <br /> ");
}
print("</div>");
}
----
Server IP: 69.147.83.197
Probable Submitter: 75.69.133.62
----
Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php
Edit -- https://master.php.net/note/edit/80845
Del: integrated -- https://master.php.net/note/delete/80845/integrated
Del: useless -- https://master.php.net/note/delete/80845/useless
Del: bad code -- https://master.php.net/note/delete/80845/bad+code
Del: spam -- https://master.php.net/note/delete/80845/spam
Del: non-english -- https://master.php.net/note/delete/80845/non-english
Del: in docs -- https://master.php.net/note/delete/80845/in+docs
Del: other reasons-- https://master.php.net/note/delete/80845
Reject -- https://master.php.net/note/reject/80845
Search -- https://master.php.net/manage/user-notes.php