Variable variables are a nice, flexible tool for when you're transforming data types (say, arrays to classes). At the very worst case, they're good for using some kind of string data that has come down the pipe to serve as scalar variables for future use. I'd like to rail against the abuse of strings by many developers in PHP web development, but that's probably best saved for another blog post. I've been seeing variable variables get brought up a lot on the usual sources lately. Yes, they're cool, but there's always the usual 'hammer and nail' argument about PHP. You can give a developer a powerful tool, but it doesn't mean they won't get ahead of themselves in using (or abusing) it. Here is something you must never, never, never EVER do:

    for ($i = 1; $i < count($anArrayOfThings); $i++)
    {
        ${'thing'.$i} = 'some value';
    }

There is absolutely no reason to do this. Unfortunately, I have seen it in real, life, actually-used-to-make-money code. It's a mistake someone in their first year of PHP development should make, only to get swiftly corrected by a more senior developer. As I'm getting older, I suppose it's weird to be that guy.

Anyhow, there's a really simple way to both create an access related items iteratively, and you're probably already using it to build out junk variables like this. Obviously, it's an array:

    $myArr = array();
    foreach ($anArrayOfThings as $thing)
    {
        $myArr[] = "that same value";
    }

I had a great professor in grad school who had a great saying: "Do the dumb thing first." When applied to machine learning, it meant use the most naive model you possibly could and see how far that got you with data predictions. Sometimes killing yourself over using some cutting-edge model only squeezes a half percentage more accuracy to your solution. In other words, be pragmatic, and use well-tested tools that get you most of the way there to your solution, and then fit your solution around those tools. Don't waste your time with variable variables unless you really, really, really need them. And you probably don't. Are you trying to write a quine, or an interactive command prompt for PHP? Well, you probably don't even need them then.

Variable variables can be pretty nifty, but they shouldn't be your first solution. And if you think they're the only solution, then you need to step back for a few minutes and determine whether or not the choices you have made to get you to this chunk of code were the correct ones.