PHP code example of jakub-frajt / typed-list

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

    

jakub-frajt / typed-list example snippets


use Frajt\IntegerList;

// create IntegerList from array
$integerList = new IntegerList([1, 2, 30]);

// numeric string values are automatically casted to integer
$integerList = new IntegerList(['1', 2, 30]);

$integerList->getValues(); // get values as array [1, 2, 30]

// support \Iterator interface
foreach ($integerList as $intValue) {
    echo $intValue.PHP_EOL;
}