One thing I love about PHP is that simple things can be done with very little code, but at the same time there are several ways one can achieve a goal, allowing for a more fine tuned solution to the task at hand. Some feel the enormous function reference in PHP is one of it's failings as a programming language. I can see that point of view but for me personally, I appreciate the ability to use one of several different methods to get a job done (and even after years of writing apps in PHP I still sometimes stumble upon a function that is just what I need!). Having both a high level quick-and-dirty method, and a more complicated but more precise method allows for greater flexibility as a programmer. One area however in which PHP has really lacked over the years is handling file uploads, especially large files.
Clean URLs are nice. And it's nice to be nice. So we always use clean URLs. Most rewrite examples found online look something like this:
RewriteRule ^topic/banana/$ filename.php?topic=banana
This puts an entry in the $_GET array with the name "topic" and the value "banana". Very nice. But it does not scale well. For a big site with a lot of possible URL combinations the amount of rules can be problematic, and just a pain to keep having to adjust or add to. And unless I am mistaken, the more rules you have the more overhead for mod_rewrite (generally speaking). We have to within a web application or site analyze the URL arguments in PHP anyway, so using a more general type of rewrite regex we can use a nicer approach. The word for today by the way appears to be nice.
So I am sitting around very late at night, absolutely should be sleeping but apparently against my better judgement have decided to write about variable variables in PHP. I'm reminded of a great boss I used to have who when presented with a new top priority by the company honchos that none of us had time for would look you straight in the eye and with statue like seriousness mention "I seem to recall you have some free time between midnight and 6". So why write about variable variables, and what are they and why do you care?
Years ago while working through the framework of Hastymail, I came across a need to have a simple and fast lightweight encryption routine. At the time the mcrypt module of PHP was not so widely available as it is now, and I wanted something without external dependencies including PHP mods that were not default on most distros. RC4 is an older, lightweight encryption algorithm, by no means uncrackable, but suitable for certain encryption tasks in which limited overhead is required and cipher strength is not a top priority. So I wrote a simple RC4 implementation in PHP based on the by then widely available algorithm. It's a single function that takes two arguments, a string to encrypt/decrypt and a "secret key" that forms the basis of the encryption.
You seem to have stumbled onto my blog, so welcome!
This is just a little place to talk about technology stuff, the day to day happenings of a free-lance programmer and Open Source enthusiast, and whatever crosses my mind and seems worth writing down for some reason :) My name is Jason Munro, I am a programmer at and founding partner of GreyBeard Inc. I have been working as an administrator and programmer for almost 8 years, the last few focusing primarily on building web applications on Linux using the LAMP stack (the PHP variety). I have been a long time Linux user and Open Source community member, contributing to several PHP based webmail applications over the years. What follows is the likely long winded and breathtakingly boring story of how I came to be a freelance web application developer. So if the Nyquil is not cutting it for you, by all means dim the lights and read on.



