PHP code example of alecrabbit / accessories

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

    

alecrabbit / accessories example snippets


$r1 = G::range(1, 3); 
$r2 = G::rewindableRange(1, 3); 

$c = new Circular([1, 2, 3]);
$value = $c(); // invoke 
$value = $c->getElement(); // method 

$r = new Rewindable($generatorFunction);
iterator_to_array($r);
$r->rewind();

Pretty::bytes(10584760, 'mb'); // string(7) "10.09MB"
Pretty::time(0.214); // string(5) "214ms"
Pretty::precent(0.214); // // string(6) "21.40%"

$report = MemoryUsage::report('mb');
echo $report . PHP_EOL;