Jump to content

Checking Empty/Null Variables


JustinK101

Recommended Posts

Hello all, I have been programming in PHP for a while, but never quite learned the best/effective way to check if a variable is empty?

What is the best method to use?

if(!isset($var))
if($var == null)
if($var == "")
if(empty($var))
if(is_null($var))
Link to comment
https://forums.phpfreaks.com/topic/22309-checking-emptynull-variables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.