note 80845 deleted from control-structures.foreach by philip

From: Date: Wed, 18 Jun 2008 00:09:38 +0000
Subject: note 80845 deleted from control-structures.foreach by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140547@lists.php.net to get a copy of this message
Note Submitter: sorin21us at yahoo dot com ---- 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>"); }

« previous php.notes (#140547) next »