I have an array that is like
Array([GOOG] => 1, [AAPL] => 2);
How can I do a foreach where I can grab the value like GOOG (the list is ordered by the number value)
Thanks,
Fred
Foreach help
-
ExtremeGaming
- Posts: 205
- Joined: Mon Jul 09, 2012 11:13 pm
Re: Foreach help
It's actually a lot simpler than one would think
Here's an example.
<?php
$array = array("Test" => "successful"); // Just a sample array
foreach($array as $key => $value) {
echo $key." returned ".$value; // Displays "Test returned successful"
}
?><?php while(!$succeed = try()); ?>