Jump to content

help with if statement


MDanz

Recommended Posts

Well, never used this func so can't be sure but I assume it returns false if fails so:

 

if($tags = get_meta_tags($url)){
// do stuff
}else{
// do something else
}

 

Not entirely sure assigning vars within an argument is best practice though, so you could use a ternary operator instead:

 

$tags = (get_meta_tags($url)) ? get_meta_tags($url) : false;

if($tags){
// do stuff
}else{
// do something else
}

 

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.