Know that nobody will be embarassed here by a show of genuine effort and will to learn.
Just show us what you have tried so far. The Monks will take it from there.
To get you on your way, try first to build the array with the deck.
Just follow the steps 'b' and 'c' quite literally. The array with the cards should finally contain entries like "Ace of Hearts", "10 of Spades", ...
You can build these entries as follows::
with the variables $type and $suit being provided by the two foreach loops.$card = "$type of $suit";
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re: Nested foreach loops
by CountZero
in thread Nested foreach loops
by peterstriker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |