1. Go to this page and download the library: Download mkoubik/sloth 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/ */
mkoubik / sloth example snippets
use Sloth\LazyString;
$string = new LazyString(fn () => 'Hello world!');
echo $string; // callback is called at this point
echo $string; // callback is not called any more
use Sloth\LazyIterator;
$iterator = new LazyIterator(fn () => range(1, 9999));
foreach ($iterator as $number) { // callback is called at this point
echo $number . "\n";
}
echo count($iterator); // works too
use Sloth\LazyAccessor;
$person = new LazyAccessor(fn () => new Person('John Doe'));
echo $person->name; // callback is called at this point
if (isset($person->name)) {
unset($person->name);
}
echo $person->setName('John Doe');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.