I'm aware of the benchmarks for isset() vs empty(), but I have code I need to execute only when the argument is null. This is in a function that executes many times so I'd like to optimize it.
I know that isset() is faster than empty(), but what about !isset() vs. === null? I know that the variable will exist, so I only need to test it against null.
I'm thinking of the possible penalty for the ! operator.
=== null
is faster but will throw an error if the value was not set. But if you set the variable to null at the start of your script (so you are sure that the variable will either have a value or null) you can use the comparison operator, which is faster. But the difference is really that small, it's better to opt for readability in your code here. – Galosh