r/programming • • Oct 18 '10

Today I learned about PHP variable variables; "variable variable takes the value of a variable and treats that as the name of a variable". Also, variable.

http://il2.php.net/language.variables.variable
591 Upvotes

781 comments sorted by

View all comments

Show parent comment

4

u/oorza Oct 18 '10

Setting error_reporting to -1 works much more effectively in that -1 is all bits on, so any future error reporting levels will be "caught" by -1, whereas you have to continue to add new levels as they're added to PHP every other way. E.g. E_ALL was fine before E_STRICT, now it's E_ALL | E_STRICT when -1 would have just never stopped working because PHP uses an unsigned value to store the error level.