Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Defining a custom assert() function is not allowed,

Description

assert() is a PHP native function, used to create assertions. To avoid confusion, or redefinition of this function, it is not allowed to create a custom version of this function, even in a namespace.

Example

<?php

namespace X;

function assert() {}

?>

Alternatives

  • Give another name to that function.
  • Make it a method.
  • Make it a Closure.