Since isset appears to be a function (http://php.net/manual/en/function.isset.php), there might be some overhead for calling it. So I wonder if using !== null instead of isset would produce faster code while, most importantly, keeping the code's behavior exactly the same?
From PHP Manual:
isset — Determine if a variable is set and is not NULL
isset Returns TRUE if var exists and has value other than NULL, FALSE otherwise.
http://php.net/manual/en/function.isset.php
The function call overhead is so small you probably don't need to worry about it. Read this post: Why are PHP function calls *so* expensive?
Note that isset is not a function (it has a special opcode for it), so it's faster.
What about $foo = NULL, a variable can be set, and also be null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With