> Hi all, > I'm kind of new with PHP. I work alot with another language called Lasso, > reminds kind of PHP but not the same. > I trying to search after a desired value within an array map (think you > call > it like that in PHP) and to get the value out as well. > > Is this possible in any way? Like to show you how it works in Lasso while > I'm talking about. > > Could look like this: > > <?LassoScript > > var: 'colors'=(map: 'red'='#ff0000', > 'green'='#00ff00','blue'='#0000ff'); > output: $clors->(find: 'blue'); > > ?> > > The result you get is #0000ff. > > Can you do something like this with PHP. Would help me alot if anyone > could > help me out a bit. > > Thanks in advance // Jonas > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > $colors = array( 'red' => '#ff0000', 'green' => 'X00ff00', 'blue' => '#0000ff' ); echo $colors['blue']; // or: $val = 'blue'; if (array_key_exists($val, $colors)) { echo $colors[$val]; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php