H
H
Hannskod2018-02-21 18:22:52
PHP
Hannskod, 2018-02-21 18:22:52

How to convert a whole number to a fraction?

Good day, tell me how to make 1.0000 from an integer

Answer the question

In order to leave comments, you need to log in

5 answer(s)
V
Vladislav Nagorny, 2018-02-21
@esvils

try number-format

S
Sergey, 2018-02-21
@chelovekmuravei

In the comments ->

D
Dmitry, 2018-02-21
@mytmid

php how to display zeros after dot?
php.net/manual/en/function.sprintf.php

A
Artem Spiridonov, 2018-02-21
@customtema

(float) or floatval()

K
krypt3r, 2018-02-22
@krypt3r

JSON_PRESERVE_ZERO_FRACTION (integer)
Ensures that a float value will be converted exactly to a float value if the fractional part is 0. Available since PHP 5.6.6.

Perhaps this should be used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question