i am using this code to check if the variables $n0, $n1, $n2
are not defined.
But i get a notice each time that was not defined. My code is a bad practice? there is any alternative? or just remove the notices and the code is fine?
if (!isset ($n0) && $n0 != $form['name0']){
echo ("n0");
}
if (!isset ($n1) && $n1 != $form['name1']) {
echo ("n1");
}
if (!isset ($n2) && $n2开发者_StackOverflow社区 != $form['name2']) {
echo ("n2");
}
thanks
You should actually be replacing those &&
's with ||
's. If the $n
's aren't set then they surely won't equal the $form
values..
This will prevent the notices and do what you're intending
精彩评论