Schlo_50 Posted June 3, 2008 Share Posted June 3, 2008 Hello, I have the folowing code which check to see if my variables are null or not. However if all of my variables are null then as the script continues it generates errors. Is there any way using what I have below, to make it so that the rest of the script isn't run if all of my variables are null? $arrString = array(); if(!is_null($relevanta)) $arrString[] = $relevanta; if(!is_null($relevantb)) $arrString[] = $relevantb; if(!is_null($relevantc)) $arrString[] = $relevantc; if(!is_null($relevantd)) $arrString[] = $relevantd; if(!is_null($relevante)) $arrString[] = $relevante; if(!is_null($relevantf)) $arrString[] = $relevantf; $srt_string = implode(",", $arrString); Thanks Link to comment https://forums.phpfreaks.com/topic/108542-solved-if-else/ Share on other sites More sharing options...
Schlo_50 Posted June 3, 2008 Author Share Posted June 3, 2008 Ignore me. I feel like a n00b. lol Solved Link to comment https://forums.phpfreaks.com/topic/108542-solved-if-else/#findComment-556573 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.