Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 80 | All time: 10,110 This week: 660 |
Version | License | PHP version | Categories | |||
loops 1.0 | MIT/X Consortium ... | 8.0 | PHP 5, Language |
You can install the package via composer:
composer require isaeken/loops
loop(5, function ($loop, $instance) {
return $loop->odd;
}); // [false, true, false, true, false]
loop(2 ,function ($loop, $instance) {
return [
'iteration' => $loop->iteration,
'index' => $loop->index,
'remaining' => $loop->remaining,
'count' => $loop->count,
'first' => $loop->first,
'last' => $loop->last,
'odd' => $loop->odd,
'even' => $loop->even,
];
});
// [
// [
// 'iteration' => 0,
// 'index' => 0,
// 'remaining' => 1,
// 'count' => 2,
// 'first' => true,
// 'last' => false,
// 'odd' => false,
// 'even' => true,
// ],
// [
// 'iteration' => 1,
// 'index' => 1,
// 'remaining' => 0,
// 'count' => 2,
// 'first' => false,
// 'last' => true,
// 'odd' => true,
// 'even' => false,
// ]
// ]
loop(3, function ($loop, $instance) {
if ($loop->index > 1) {
$instance->stop();
}
return $loop->index;
}); // [0, 1]
loop_random(function ($loop, $instance) {
return $loop->index;
}); // executed random times.
$min = 5;
$max = 10;
loop_random(function ($loop, $instance) {
return $loop->index;
}, $min, $max);
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.
Files (16) |
File | Role | Description | ||
---|---|---|---|---|
.github (3 files, 2 directories) | ||||
src (2 files) | ||||
tests (1 file) | ||||
.editorconfig | Data | Auxiliary data | ||
.php_cs.dist.php | Aux. | Auxiliary script | ||
CHANGELOG.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE.md | Lic. | License text | ||
phpunit.xml.dist | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files (16) | / | .github |
File | Role | Description | ||
---|---|---|---|---|
ISSUE_TEMPLATE (1 file) | ||||
workflows (2 files) | ||||
CONTRIBUTING.md | Data | Auxiliary data | ||
FUNDING.yml | Data | Auxiliary data | ||
SECURITY.md | Data | Auxiliary data |
Files (16) | / | .github | / | workflows |
File | Role | Description |
---|---|---|
php-cs-fixer.yml | Data | Auxiliary data |
run-tests.yml | Data | Auxiliary data |
Files (16) | / | src |
File | Role | Description |
---|---|---|
helpers.php | Aux. | Auxiliary script |
Loop.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.