That is because all that $suite['heart']
contains is 5
.
You are declaring $suite['heart'] = 1;
then redeclaring $suite['heart'] = 2;
etc.
I think what you are looking for in your array is something more like
$suite['heart'] = array(1, 2, 3, 4, 5);
Also note that $rand = array_rand($suite);
will only ever retrieve a direct child of $suite
(always $suite['heart']
if you don't have any others defined) - you will also have to pick a random value from the sub-array to get a random suit and number.
The following should work:
$suite['heart'] = array(1, 2, 3, 4, 5);
$suite['spade'] = array(1, 2, 3, 4, 5);
$suit = array_rand($suite);
$card = array_rand($suite[$suit]);
$card1 = $suite[$suit][$card];
print $card1;