Saturday, 15 December 2018

Can a namespace start with a number in PHP?

When declaring the following namespace:


namespace Example\3000;

I got this error:


Parse error:  syntax error, unexpected '3000' (T_LNUMBER), expecting identifier (T_STRING) in [...]

So I wondered whether a namespace in PHP may start with a number?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...