coercive / iterator
Coercive Utility Iterator
0.0.3
2023-06-30 11:04 UTC
Requires
- php: >=7.4
This package is auto-updated.
Last update: 2024-10-30 02:04:57 UTC
README
Item iterator
Get
composer require coercive/iterator
Example Multibyte String Iterator
foreach (new MbStrIterator('string') as $i => $chr) { echo "$i => $chr \n"; }
Example Array Sort
$examples = array( 1 => array( 'id' => 'abcd', ), 2 => array( 'id' => 'ABCD', ), 3 => array( 'id' => 'aabcd', ), 4 => array( 'id' => 'aAbcd', ), 5 => array( 'id' => 'AAbcd', ), ); # Instantiate with data $array = new Sort($examples); # [optional] Set case-insensitive if useful $array->insensitive(true); # [optional] Set targeted key level $array->level(1); # Sort ASCENDING $sorted = $array->asc('id'); # Sort DESCENDING $sorted = $array->desc('id');