PHP 5: if (\false)

I was wondering why the typical class alias boilerplate code uses this weird backslash in if (\false) like here for example.

It turns out this code will wish you a happy debugging in PHP 5.3-5.6:

<?php

namespace ns;

define('ns\\false', 1);

if (false) {
    echo "Happy Debugging", PHP_EOL;
}

Not a very useful knowledge now but an interesting history fact.

Comments

Comments powered by Disqus