1.2.1264. Undefined Constant Name

When using the ```` syntax for variable variable, the name used must be a defined constant. It is not a simple string, like 'x', it is an actual constant name.

Interestingly, it is possible to use a qualified name within the brackets, relative ``, full `` or partial ````. PHP lints such code, and collects the value of the constant immediately. Since there is no fallback mechanism for fully qualified names, this ends with a Fatal error.

<?php

const x = "a";
$a = "Hello";

// Display 'Hello'  -> $a -> Hello
echo ${x};

// Yield a PHP Warning
// Use of undefined constant y - assumed 'y' (this will throw an Error in a future version of PHP)
echo ${y};

// Yield a PHP Fatal error as PHP first checks that the constant exists
//Undefined constant 'y'
echo ${a\y};

?>