The (real) cast operator has been removed, use (float) instead. Both operator looked like synonyms, and were providing the same feature.

Description

The (real) cast operator was deprecated in PHP 7.x and is completely removed since PHP 8.0. It may be replaced with (float).

Example

<?php

$float = (real) "1.333";

?>

Solutions

  • Use (float) instead.

In previous PHP versions, this error message used to be The (real) cast is deprecated, use (float) instead.