MDanz Posted March 8, 2010 Share Posted March 8, 2010 $tags = get_meta_tags($url); i have this variable. I'd like to do an if statement. If ($tags able to get meta tags) {} else {} Link to comment https://forums.phpfreaks.com/topic/194527-help-with-if-statement/ Share on other sites More sharing options...
Anti-Moronic Posted March 8, 2010 Share Posted March 8, 2010 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 } Link to comment https://forums.phpfreaks.com/topic/194527-help-with-if-statement/#findComment-1023111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.