3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function get_progress_bar($length, $progress, $total, $block = '=', $space = ' ') { $perBlock = $total / $length; $blocks = floor($progress / $perBlock); return str_repeat($block, $blocks) . str_repeat($space, $length - $blocks); } $length = 20; $total = 100; echo get_progress_bar($length, 1, $total) . "\n"; echo get_progress_bar($length, 5, $total) . "\n"; echo get_progress_bar($length, 31, $total) . "\n"; echo get_progress_bar($length, 69, $total) . "\n"; echo get_progress_bar($length, 80, $total) . "\n"; echo get_progress_bar($length, 100, $total) . "\n";
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
= ====== ============= ================ ====================