Eno\Loaders ยป float

float() โ†’ float
floatItems() โ†’ array
floatList() โ†’ array

Accepts floats (decimal part can be missing though), returns a float (or throws a ValidationError for malformed values).

enogood: 49.9
fine: -2
bad: three
php$document = Parser::parse($input);

$document->float('good');  // returns 49.9
$document->float('fine');  // returns -2.0

$document->float('bad');
  // throws a ValidationError: 'bad' must contain a decimal number, for instance '13.0', '-9.159' or '42'.