T
T
T3R3AND2020-04-26 18:40:33
PHP
T3R3AND, 2020-04-26 18:40:33

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

4 answer(s)
D
Daria Motorina, 2020-04-26
@T3R3AND

It seems like a normal thing, although the
Symfony progress bar
UPD did not use it. More on packagist ( link )

4
4sadly, 2020-04-26
@4sadly

<progress max="100" value="25">
    Загружено на <span id="value">25</span>%
</progress>

you can simply and substitute the% you need Click
<progress max="100" value="25"></progress>

A
Andrey, 2020-04-26
@AndryG

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)

H
hesy, 2020-05-14
@hesy

I'm probably late, but I'll leave it here, there is a wonderful CLImate bibla .
And here is just an example from the documentation with a progress bar

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question