- Suggested by FredBouchery
- Created on 2020-07-23
- Difficulty: expert
What will be displayed? 🤔

✅ { answer }: correct!
❌ { answer }: Wrong answer!
PHP namespaces can contain space characters, but they can\'t begin with a backslash. The right answer was "A".▶ Click here to run this code on 3v4l.org
Poll
-
✅ A: Fatal error: Uncaught Error: Undefined constant 'Foo\Bar'
- 12.5%
-
B: Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR)'
- 37.5%
-
C: Foo\Bar\A - 17.5%
-
D: Foo\Bar\B - 32.5%
Click here to see output differences between PHP versions
As I am writing this quiz (2020-07-31), there is a slight difference between all versions and PHP 8.0.0alpha3:
With this last version, the exception message "Foo\Bar" is wrapped by double quotes instead of single quotes for other versions (\'Foo\Bar\'). 🤔