Skip to content

Instantly share code, notes, and snippets.

@ardani
Forked from mayconbordin/progress_bar.php
Created July 29, 2019 05:30
Show Gist options
  • Save ardani/a3399b3d3b95d4bcd2887ac931d099db to your computer and use it in GitHub Desktop.
Save ardani/a3399b3d3b95d4bcd2887ac931d099db to your computer and use it in GitHub Desktop.

Revisions

  1. @mayconbordin mayconbordin created this gist Jun 2, 2012.
    7 changes: 7 additions & 0 deletions progress_bar.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    <?php

    function progress_bar($done, $total, $info="", $width=50) {
    $perc = round(($done * 100) / $total);
    $bar = round(($width * $perc) / 100);
    return sprintf("%s%%[%s>%s]%s\r", $perc, str_repeat("=", $bar), str_repeat(" ", $width-$bar), $info);
    }