Forced Conversion to Floating-Point Numbers in PHP
Suppose we now have a string with a floating-point number:
<?php
$test = '1.2';
var_dump($test);
?>
To convert this string to a number, you should
use the float command:
<?php
$test = (float) '1.2';
var_dump($test); // outputs 1.2
?>
Convert the following string to a number:
<?php
$test = '12.345';
?>