0

Can anyone tell me the different between checking if a variable has value using the empty() function or "truthy" in an if statement? As far as I can tell they achieve the same thing?.. I am writing a function for Wordress that loops through the taxonomies and both work but I am not sure which is best.

   $taxonomies = get_taxonomies($args, $output, $operator);

      if (!empty($taxonomies)) {

      ...code here

    }

or

$taxonomies = get_taxonomies($args, $output, $operator);

  if ($taxonomies) {

...code here

}
caffeinehigh
  • 309
  • 1
  • 3
  • 11

0 Answers0