У меня простая карточная игра (с использованием 52 карт - без шутников), которые я хочу случайным образом выбрать по 1 карте за раз, пока не будет выбрана выигрышная карта.
У меня есть следующий массив:
$cards = array(
'diamond' => array(
'A', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K'
),
'heart' => array(
'A', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K'
),
'club' => array(
'A', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K'
),
'spades' => array(
'A', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K'
),
);
Как вы можете видеть, этот массив сортируется. Я хотел бы перетасовать их с помощью функции PHP shuffle($cards);
, но это не сработало.
Что я могу сделать, чтобы получить это?