PHP code example of diephp / sequences
1. Go to this page and download the library: Download diephp/sequences 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/ */
diephp / sequences example snippets
$sequence = new \DiePHP\Sequences\ExponentialSequence(1, 100);
foreach ($sequence AS $value) {
var_dump($value);
}
/**
* int(1)
* int(2)
* int(4)
* int(8)
* int(16)
* int(32)
* int(64)
......
*/
$sequence = new \DiePHP\Sequences\ProgressiveSequence(100, 50);
foreach ($sequence AS $value) {
var_dump($value);
}
/**
* int(100)
* int(150)
* int(250)
* int(400)
* int(600)
* int(850)
* int(1150)
......
*/
$sequence = new \DiePHP\Sequences\RandSequence(50, 60);
foreach ($sequence AS $value) {
var_dump($value);
}
/**
* int(55)
* int(58)
* int(51)
* int(55)
* int(60)
* int(54)
* int(51)
* int(50)
* int(55)
......
*/
$sequence = new \DiePHP\Sequences\LinearSequence(1, 10);
foreach ($sequence AS $value) {
var_dump($value);
}
/**
* int(1)
* int(11)
* int(21)
* int(31)
* int(41)
* int(41)
* int(51)
......
*/
$sequence = new \DiePHP\Sequences\LinearSequence(0, 10);
foreach ($sequence AS $value) {
var_dump($value);
}
/**
* int(0)
* int(10)
* int(20)
* int(30)
......
*/