PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have recently been trying to write a section of code that will allow a video to be shown either at it's default size, or at a user value. To do this I have been using two switch statements like this:
Almost every time I get the Unexpected T_something error, it's because I've forgotten a semicolon above the line that pops the error... check for that.
thanks for everyone's great response... thanks for reminding me of the (ever present) function option - it works great now with roughly the same syntax as wurdup suggested.
In answer to tasairis, I used an if statement to use the $size variable only if it was present:
The issue is that you're misusing switch. It has a very specific form and you have to stick to it.
But yeah, stick it in a function.
And also, putting PHP code in a .txt file, especially one that's accessible over the web, is a very bad idea. Stick to .php.