PHP code example of jamsouf / repeat

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

    

jamsouf / repeat example snippets

 php
 php
$results = Repeat::_function(100, function () {
    // your function code
});
 php
$calculate = function ($result) {
    // your function code
};

$results = Repeat::_function(20, $calculate);
 php
$calculate = function ($result) {
    // your function code
};

$until = function ($result) {
    // return true or false
};

$results = Repeat::_function(50, $calculate, $until);
 php
$result = Repeat::_string(10, 'v1.{j}.{i}', function ($result) {
    return strpos($result, '.4.') !== false ? true : false;
}, ', ');

// => v1.1.0, v1.2.1, v1.3.2, v1.4.3