PHP tip, check if a variable exists and has a specific value

0
PHP tip, check if a variable exists and has a specific value

Today I encourage you to write an article on the blog again after a long time. This time is just a trick  or advice for when you are developing a plugin or theme, for example.

If you have ever developed about PHP, it is very likely that you have encountered many Notices because a variable does not exist. That’s when we pull an if (isset ($ var)) … and inside that if , we do what we want with it.

And many of those times, we check with another if if the variable has some concrete value to perform an action. That is, something kind:

LEAVE A REPLY