How to find whether a variable is NULL in PHP

3 Answers

0 votes
$n = 300;

var_dump(is_null($n));

/*
run: 

bool(false)  

*/

 



answered Jul 1, 2016 by avibootz
0 votes
$n = null;

var_dump(is_null($n));

/*
run: 

bool(true)  

*/

 



answered Jul 1, 2016 by avibootz
0 votes
var_dump(is_null($n));

/*
run: 

Notice: Undefined variable: n in C:\xampp\htdocs\allonpage.com\test.php on line 8
bool(true)  

*/

 



answered Jul 1, 2016 by avibootz

Related questions

1 answer 154 views
3 answers 238 views
3 answers 271 views
8 answers 604 views
2 answers 230 views
8 answers 432 views
4 answers 227 views
...