Re: Searching and getting values out of array maps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's a stab...

$colors = array("red"=>"#ff0000","gree"=>"#00ff00","blue"=>"#0000ff");
echo $colors["blue"];

should output #0000ff
HTH
-Brad

Jonas Rosling wrote:

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux