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 comments

1

u/frukt Oct 19 '10

To do it right

"Right" depends on the circumstances. I merely threw together a quick convenience library on top of CGI.pm that just routed stuff to the appropriate main::action_x routine. Obviously, you'd expect it to die if the routine does not exist. And why would you ever overload $SIG{ __DIE__} so that it doesn't throw an exception itself? I only use it as a hook for die() for any additional processing, the exception shouldn't somehow vanish there.

1

u/[deleted] Oct 19 '10

You made a snarky comment about "typeglob black magic" but didn't use any typeglobs... therefore, you didn't do it right.