The (real) cast is deprecated, use (float) instead¶
Description¶
The (real)
cast operator is deprecated since PHP 7.4. It was completely removed in PHP 8.0. (real)
was a synonym of (float)
, although there is no such notion in PHP.
Example¶
<?php
$float = (real) 1.333;
?>
Solutions¶
Use
(float)
instead.
In more recent PHP versions, this error message is now The (real) cast operator has been removed, use (float) instead. Both operator looked like synonyms, and were providing the same feature..