607
Member
Hello, I've got an issue when turning a real value read from an ini file into a string.
Take the following, with the example value being 4.4000000000:
string(ini_read_real("Example","Test",0)) gives "4.40"
string(floor(ini_read_real("Example","Test",0))) gives "4"
string(floor(10*ini_read_real("Example","Test",0))) gives "44"
string(floor(10*ini_read_real("Example","Test",0))/10) gives "4.40"
How do I get it to display 4.4? I could take the 0 from the string, but then I'd need to do an extra test to see if it's a zero after the decimal point and not before it, and it doesn't seem like a nice way anyway.
Take the following, with the example value being 4.4000000000:
string(ini_read_real("Example","Test",0)) gives "4.40"
string(floor(ini_read_real("Example","Test",0))) gives "4"
string(floor(10*ini_read_real("Example","Test",0))) gives "44"
string(floor(10*ini_read_real("Example","Test",0))/10) gives "4.40"
How do I get it to display 4.4? I could take the 0 from the string, but then I'd need to do an extra test to see if it's a zero after the decimal point and not before it, and it doesn't seem like a nice way anyway.