PHP code example of chrisharrison / php-array-of

1. Go to this page and download the library: Download chrisharrison/php-array-of 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/ */

    

chrisharrison / php-array-of example snippets


public function dealCard(string $cardName): Card;

public function getIntegers(): ArrayOfInteger;

$integers = new ArrayOfInteger([1,1,2,3,5,8,13]);

$sum = $integers[5] + $integers[6]; // equals 21

final class ArrayOfCard extends ArrayOf
{
    protected function typeToEnforce(): string
    {
        return Card::class;
    }
}

$aceOfSpades = new Card('spades', 'ace');
$threeOfClubs = new Card('clubs', '3');

$cards = new ArrayOfCard([$aceOfSpades, $threeOfClubs]);

composer