PHP TypeLang Help

Float Coercion

Cast passed value into a PHP float type.

Input Value

Output Result

Description

float(T)

float(T)

Returns float value "as is"

int(T)

float(T)

Converts int to a float value [1]

string(T)

float(T)

Converts string to a float value [2]

bool(false)

float(0.0)

bool(true)

float(1.0)

null

float(0.0)

Other

never

Throws InvalidValueException exception

Notes

  1. The int-to-float casts uses built-in PHP rules:

    • The mantissa 0 will be added

  2. The string value must satisfy the following rules:

05 November 2025