Multidimensional array


#1







<?php
$deck = array(array('2 of Diamonds', 2),
array('5 of Diamonds', 5),
array('7 of Diamonds', 7));
array('4 of Diamonds', 4);
// Imagine the first chosen card was the 7 of Diamonds.
// This is how we would show the user what they have:
echo 'You have the ' . $deck[2][0] . '!';
?>



I dont understand I added another array but says error


#2

You have to remove the ");" by the 7 of diamonds array and add another ")" after the 4 of diamonds array.


#3

i figured it out cheers mate


#4







<?php
$deck = array(array('2 of Diamonds', 2),
array('5 of Diamonds', 5),
array('7 of Diamonds', 7), array('4 of Diamonds', 4));

  // Imagine the first chosen card was the 7 of Diamonds.
  // This is how we would show the user what they have:
  echo 'You have the ' . $deck[2][0] . '!';
  ?>
</p>


Cant figure out what is wrong with this code. Anyone help?


#5

Try this code.
<?php
$deck = array(array('2 of Diamonds', 2),
array('5 of Diamonds', 5),
array('10 of Diamonds', 10),
array('7 of Diamonds', 7));

  // Imagine the first chosen card was the 7 of Diamonds.
  // This is how we would show the user what they have:
  echo 'You have the ' . $deck[2][0] . '!';

?>