Supported Versions: PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8
Get float value of a variable
<?php floatval(mixed $value): float
<?php public function float($key, $default = 0.0)
{
return floatval($this->input($key, $default));
}
<?php }
switch (true) {
case floatval($number) === 0.0:
return $precision > 0 ? static::format(0, $precision, $maxPrecision) : '0';
case $number < 0:
return sprintf('-%s', static::summarize(abs($number), $precision, $maxPrecision, $units));
<?php public function toFloat()
{
return floatval($this->value);
}
<?php return $size;
}
$value = floatval($size);
return round(match (true) {
Str::endsWith($size, 'kb') => $value * 1,
<?php $alpha = floatval(round($alpha[0] / 255, 2));
}
}
<?php return;
}
return floatval($data);
}
public function preProcessConfig($data)
<?php public function preProcessConfig($data)
{
return floatval($data);
}
public function process($data)
<?php return;
}
return floatval($data);
}
}
<?php $dec_point = Arr::get($params, 1, '.');
$thousands_sep = Arr::get($params, 2, ',');
$number = floatval(str_replace(',', '', $value));
return number_format($number, $precision, $dec_point, $thousands_sep);
}