Skip to content

Instantly share code, notes, and snippets.

View mariapaulinar's full-sized avatar
🐶

María Paulina Ramírez Vásquez mariapaulinar

🐶
View GitHub Profile
@mariapaulinar
mariapaulinar / progress_bar.php
Created October 25, 2019 04:50 — forked from mayconbordin/progress_bar.php
PHP CLI progress bar in 5 lines of code
<?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);
}