Jump to content

Muck A. Round

Members
  • Posts

    2
  • Joined

  • Last visited

Muck A. Round's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Ah - thanks everyone. What I was missing was that an associative array is defined as KEY => VALUE. So when you say "value" you're not talking about the value (or amount?) of any given entry, but value as the entity that each key is associated with.
  2. I feel like I'm missing something on the example for Sort Array (Ascending Order), According to Value - asort(). I added a var_dump and also switched the variables to ABC, and don't see that any sorting is occurring. <!DOCTYPE html> <html> <body> <?php $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); asort($age); var_dump($age); echo "<br><br>"; foreach($age as $x => $x_value) { echo "Key=" . $x . ", Value=" . $x_value; echo "<br>"; } echo "<br>"; $age = array("C"=>"35", "B"=>"37", "A"=>"43"); asort($age); var_dump($age); echo "<br>"; echo "<br>"; foreach($age as $x => $x_value) { echo "Key=" . $x . ", Value=" . $x_value; echo "<br>"; } ?> </body> </html>
×
×
  • Create New...