RE: [PHP] Echo a value from an arrays position

From: Date: Thu, 04 May 2006 13:18:43 +0000
Subject: RE: [PHP] Echo a value from an arrays position
Groups: php.general 
Request: Send a blank email to php-general+get-235505@lists.php.net to get a copy of this message
[snip] Lasso can do the following, can PHP? <?LassoScript Variable: 'Colors'=(Map:'red'='#ff0000','green'='#00ff00','blue'='#0000ff'); Loop: $Colors->Size; Output: '<br>' + $Colors->(Get: Loop_Count),-EncodeNone; /Loop; ?> This outputs; ff0000 00ff00 0000ff I'm new at PHP but not Lasso that's why I'm for you asking odd questions. [/snip] 1. Always respond to the list as a single user may not be there to answer your question or your individual e-mail may get dumped to the spam list. I just happened to be cleaning my spam folder when your message popped up. B. Reading backwards is a pain. Why? Please do no top post. Less code than Lasso; $colors = array('white'=>'#ffffff','black'=>'#000000','blue'=>'#0000ff'); foreach($colors AS $key => $value){ echo $value . "<br />\n"; }

« previous php.general (#235505) next »