Jan Doggen
0
Q:

php if empty

if(empty($var1)){
    echo 'This line is printed, because the $var1 is empty.';
}
5
jQuery.isEmptyObject( object );

Example:
jQuery.isEmptyObject({}) // true
jQuery.isEmptyObject({ foo: "bar" }) // false
0

<?php

  $a = 0;

// True because $a is empty
if (empty($a)) {
  echo 
  "Variable 'a' is empty.<br>";
}

// True because $a is set
if (isset($a)) 
  {
  echo "Variable 'a' is set";
}
?>
 
0
if (empty($var)) {
    echo '$var is either 0, empty, or not set at all';
}
2
empty($var)
-2

New to Communities?

Join the community