I just updated my PHP Calendar code. I did a major update, actually. Yet again the code turned out shorter, as well as more powerful, and hopefully easier to understand, but just to make sure I added a whole bunch of comments that unfortunately increased the total size of the file. 
Because of PHP's limited features, I had to make a little trade-off. I got a ton more flexibility, but I had to use from zero to three global variables, depending on what features you want to use. You can easily name the variables whatever you want to avoid name clases, and the default names should be safe enough. Actually, now that I think about it, you can avoid the global variables if you really try (by serializing them and unserializing them into the 'eval'ed code I use, but that gain is not worth the pain.
New feature: Now, instead of providing an anonymous function that controls which days have the date linked, you just provide some code to eval. That code can use whatever variables it wants (that's where the globals come in). The code can return up to three types of metadata. It can return a URL to link the date with, a set of CSS classes to link the day with (I'll be using this for my task manager to make certain days come up with different colors depending on whether there is any task for that day and what the task's priority is), and finally a string that can be substituted for the date, so if you want to say "first", "second", "third" instead of 1, 2, 3 in your calendar, you can do that (I'll be using this for my task manager too).
That's about it. Check out the code, and feel free to e-mail if you have any questions.
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):