$user->height = 5.10
print_r(explode('.',$user->height))
Array ( [0] => 5 [1] => 1 )
How to do I get the second value to display as 10?
FYI
print_r(explode('.',5.10))
outputs the same.
$user->height = 5.10
print_r(explode('.',$user->height))
Array ( [0] => 5 [1] => 1 )
How to do I get the second value to display as 10?
FYI
print_r(explode('.',5.10))
outputs the same.
You are trying to explode a number.
The number is dropping the 0 as a number because it's irrelevant as a number. You'll have to convert your number to a string and then pad it if necessary.
$number = 5.10;
$string_version = number_format((float)$number, 2, '.', '');
print_r(explode('.', $string_version));