All Static Curly Syntaxes And One Wrong
<?php
echo A::A;
echo A::{A};
echo A::{$A};
echo A::${A};
echo A::${$A};
echo A::${${A}};
echo A::${${$A}};
echo A::${${$A}};
echo A::${${A}};
echo A::${${$A{A}}};
?>
What is the only invalid syntax in the following list?
Assume that all needed definitions are available.
Let’s review them all.
-
This is a classic class constant syntax, or an enumeration case.
-
This is the new PHP 8.3 variable class constant syntax. The trick is that the dynamic part is the global constant A.
-
This is the new PHP 8.3 variable class constant syntax. The name of the constant is in the variable $A.
-
This is the variable static property class. The name of the property is in the global constant A.
-
This is the variable static property class. The name of the property is in the variable $A.
-
This is the variable static property class. The name of the property is in the global constant A, which builds the variable variable ${A}.
-
This is the variable static property class. The name of the property is in the variable $A, which builds the variable variable ${$A}.
-
This is the variable static property class. The name of the property is in the variable variable $$A, which builds the variable variable ${$$A}.
-
This is the variable static property class. The name of the property is in the variable variable ${$A}. It is a composition of previous cases.
-
This is the problematic one. $A{A} is an attempt at reading a element at position A in the variable $A. This is a removed PHP feature, since PHP 8. It should be written $A[A], though it would be too obvious for the puzzle.
See Also
- Lots of {} [Try me]
PHP Features
Last updated: 10 September 2026