Skip to content

Latest commit

 

History

History
66 lines (48 loc) · 1.45 KB

SplFloat.md

File metadata and controls

66 lines (48 loc) · 1.45 KB

(PHP 7, PHP 8)

The SplFloat class is used to enforce strong typing of the float type.

SplFloat extends SplType {
    /* Constants */
    public const float __default = 0.0;
    /* Methods */
    public function __construct ([ float $initial_value = 0.0 ])
    final public function &__invoke(): float
}

SplFloat::__default

Example #1 SplFloat usage example

<?php
$float = new SplFloat(3.154);
$newFloat = new SplFloat(3);

echo $float . PHP_EOL;
echo $newFloat . PHP_EOL;

The above example will output:

3.154
3