PHP code example of masterklavi / phpprogress
1. Go to this page and download the library: Download masterklavi/phpprogress 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/ */
masterklavi / phpprogress example snippets
use masterklavi\phpprogress\Progress;
// init progress of 500 tasks
$progress = new Progress(500);
for ($i = 0; $i < 500; $i++)
{
// some task
usleep(rand(0, 50000));
// mark that a task was completed
$progress->show();
}
$progress = new Progress(10);
$progress->show(); // offset = 1, so value = 1
$progress->show(2); // offset = 2, so value = 3
$progress->show(6, Progress::TYPE_VALUE); // value = 6
$progress->show(4); // offset = 2, so value = 10