PHP code example of thisbar / php-array-of

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

    

thisbar / php-array-of example snippets


public function dealCard(string $cardName): Card;

public function getIntegers() : ArrayOfInteger;

$integers = 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 = ArrayOfCard([$aceOfSpades, $threeOfClubs]);

composer