I have a game that will display ten random cards based on number and suit, but I need to check an array to see if the card has already been displayed. But my local array $card
is not being saved when it passes through the function. Here is all my code for right now please try running it and tell me what I am doing wrong if you want the images they are avaiable at.
http://storealutes.com/blackjack/cards.zip
here is my php:
<?php
//suit 1=Clubs | 2=Hearts | 3=Spades | 4=Diamonds//
//Color 1=1or11 | 2-10=# | 11-12=10//
$number;
$suit;
$card = array();
function newcard($number,$suit,$card){
$arrsuit = array (clubs, hearts, spades, diamonds);
$arrnumber = array (a, 2, 3, 4, 5, 6, 7, 8, 9, 10, j, q, k);
$number = $arrnumber[rand(0,12)]; //Creates card value
$suit = $arrsuit[rand(0,3)]; //Create card suit
$card .= array ($suit ." ". $number, hello); //difines card name
return "<img src='cards/" . $suit . "-" . $number . "-150.png'/>";
}
for($i = 0; $i < 10; $i++){
echo newcard($number,$suit,$card);
}
echo $number;
foreach($card as $value){
echo $value;
}
?>