I have been learning a ton of PHP lately in an effort to build a significant amount of custom functionality into a Drupal website. As I am not a developer by trade it has been a steep climb upward. Lately I have been refactoring a lot of my code using functions. Being a noob however, I ran into some issues in that I didn’t understand how PHP scoped the usage of variables.

Case in point, I had written a function to generate a bunch of variables dynamically based on some input into the function, but I wasn’t able to use those variables outside of the function. (more…)