assert Is Reserved Function

It is not possible to create a function named assert anymore in PHP 8.0. This applies to every scopes, global or custom.

Until PHP 8.0, it was possible.

PHP code

<?php

function assert() {}

?>

Before

PHP Deprecated:  Defining a custom assert() function is deprecated, as the function has special semantics in /codes/assertIsReserved.php on line 3

Deprecated: Defining a custom assert() function is deprecated, as the function has special semantics in /codes/assertIsReserved.php on line 3
PHP Fatal error:  Cannot redeclare assert() in /codes/assertIsReserved.php on line 3

Fatal error: Cannot redeclare assert() in /codes/assertIsReserved.php on line 3

After

PHP Fatal error:  Defining a custom assert() function is not allowed, as the function has special semantics in /codes/assertIsReserved.php on line 3

Fatal error: Defining a custom assert() function is not allowed, as the function has special semantics in /codes/assertIsReserved.php on line 3

PHP version change

This behavior was deprecated in 7.4

This behavior changed in 8.0