Answer the question
In order to leave comments, you need to log in
Progress bar php?
Hello! Sorry, the question may be stupid, but how to implement it?
Progress bar, I set the percentage of work done, and php already displays it, for example, we have 5%, we have 1 - |, and everything else that is not filled ..., so I have 50% [|||||| |||....]
Answer the question
In order to leave comments, you need to log in
It seems like a normal thing, although the
Symfony progress bar
UPD did not use it. More on packagist ( link )
<progress max="100" value="25">
Загружено на <span id="value">25</span>%
</progress>
<progress max="100" value="25"></progress>
str_pad is here to help. Don't get confused by rounding.
str_pad - Pads a string with another string up to a given length I'll
try it with my fingers:
length = 50 pieces
val = 35%
first we display asterisks in the amount of ceil(50 * 35 / 100)
str_pad(res, ceil(50 * 35 / 100), '*' )
And then add dots up to 50
str_pad(res, 50, '.')
It was worth mentioning in the question that you are interested in the console version (or text/plain)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question