I guess maybe what I should be looking at is how to declare undefined in PHP. I forgot that I usually insert "var undefined;" in my JS template to make this work. I guess I need to do the same in PHP... but declaring variables is a little different.
Well, I'm not looking to define a variable as undefined, I'm trying to set undefined to null by declaring it.
takes a reserved word, undefined, and defines it, so that whenever a variable is undefined and gets called, it will return "undefined" instead of throwing an undefined variable error. This way, you can use the "||" operator instead of using the whole typeof() thing. It's not a strict standards compliant method, but it works and makes for easier error handling. Even jQuery uses it.