PHP code example of fust / cards
1. Go to this page and download the library: Download fust/cards library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fust / cards example snippets
$d = new Deck;
$d->shuffle();
//deal... an array of cards
$hand1 = $d->drawHand(10);
$hand2 = $d->drawHand(10);
//draw a single card
$card = deck->draw();
//do something with card
$value = $card->value();
$suit = $card->suit();
//special card?
if($card->isFaceCard()){...}
//cards left in the deck
$deck->count();
//start a new game...
$deck->shuffle();
class MyGameDeckProvider implements CardProvider{
public function getCards(){
//return an array of card for MyGame
}
}
//...
$deck = new Deck(new MyGameDeckProvider);