Sorry guys, flamebait again. But i need to say this: I HATE NOTIFICATION FREE PROGRAMMING in PHP!
If you want to code Java, go ahead! If you use PHP, enjoy the simplicity it brings!
Today i found this code by someone who really wants to do it right:
$email = (key_exists('email', $values)) ? $values['email'] : null;
$password = (key_exists('password', $values)) ? $values['password'] : null;
$firstName = (key_exists('firstname', $values)) ? $values['firstname'] : null;
$secondName = (key_exists('secondname', $values)) ? $values['secondname'] : null;Honestly: This does not make any sense at all. It just pollutes your code with technical constructs that don't contribute to a solution.
UPDATE: Just to make this clear: I am _not_ talking about not input filtering here! Of course every input needs to be whitelist-filtered. And every ouput escaped to prevent XSS. What i mean is internals of you script: You can count on PHP to do things for you. This is exact because PHP does it in exact the same way everytime the script is executed.