PHP code example of hylianshield / alphabet

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

    

hylianshield / alphabet example snippets



use \HylianShield\Alphabet\Alphabet;

$alphabet = new Alphabet('A', 'B', 'C');

echo sprintf(
    'Found %d entries:',
    count($alphabet)
) . PHP_EOL;

foreach ($alphabet as $character) {
    echo $character . PHP_EOL;
}


use \HylianShield\Alphabet\Alphabet;

$input    = range('A', 'Z');
$alphabet = new Alphabet(...$input);

echo sprintf(
    'Alphabet consists of %d characters.',
    count($alphabet)
);


use \HylianShield\Alphabet\Alphabet;

/**
 * @var Alphabet $alphabet
 * @var string[] $normalized
 */
$normalized = iterator_to_array($alphabet, false);

// And to de-normalize the alphabet again, simply unpack the array.
$alphabet = new Alphabet(...$normalized);