S
S
Sergey Khlopov2021-07-23 12:20:49
PHP
Sergey Khlopov, 2021-07-23 12:20:49

Do number_format and round have the same effect?

Hello, tell me please.
It doesn't matter if you use this notation: Or this: The result of these two functions is still the same . I just need to round the prices of goods, and I'm wondering if there will be a difference if I replace it with ? Thank you in advance for your response
echo number_format(320.86, 0, '.', ' ');
echo round(320.86);
321number_formatround

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2021-07-23
@Shlop

If you just need to round, then there is no need to use number_format, since it returns a String type. Use round

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question