Cast string to float PHP

> Cast string to double
> Cast string to floating point number
> Convert string to float
> Convert string to double

Description
Cast string to float


$num = floatval("10.1"); // 10.1
$num = floatval('122.34343The'); // 122.34343
$num = floatval('The122.34343'); // 0

$num = (float)"10.12";
$num = (double)"10.12"; //Same as (float)
$num = (real)"10.12"; //Same as (float)

SEE ALSO