Another reason why I love PHP is its ability to do so many things inline, while keeping the code flow amazingly simple. This is an inline anonymous switch statement, and it allows us to use a switch statement to return us something.

Adding CSRF protection to a PHP script is really easy once you understand how and what it should be doing. This post gives you a very easy example on how you can protect your forms against CRSF, with a very simple class.