acctman Posted May 8, 2008 Share Posted May 8, 2008 How would I combine the two sections below into one? if (!$width || !$height) || ($width < 160 || $height < 120 ) is that right? if (!$width || !$height) { header("HTTP/1.1 500 Internal Server Error"); echo "Invalid width or height"; exit(0); } if ($width < 160 || $height < 120 ) { header("HTTP/1.1 200 Internal Server Error"); echo "Invalid width or height. Your image is way to small."; exit(0); } Link to comment https://forums.phpfreaks.com/topic/104730-solved-combining-coding/ Share on other sites More sharing options...
rhodesa Posted May 8, 2008 Share Posted May 8, 2008 The first one is not needed. If $width or $height aren't set, the second one will still catch it, cus nothing is less then 160 and 120 Link to comment https://forums.phpfreaks.com/topic/104730-solved-combining-coding/#findComment-536077 Share on other sites More sharing options...
acctman Posted May 8, 2008 Author Share Posted May 8, 2008 thanks Link to comment https://forums.phpfreaks.com/topic/104730-solved-combining-coding/#findComment-536091 Share on other sites More sharing options...
rhodesa Posted May 8, 2008 Share Posted May 8, 2008 But, logic aside, if they are all ORs, you don't need parenthesis around them: if (!$width || !$height || $width < 160 || $height < 120 ) Link to comment https://forums.phpfreaks.com/topic/104730-solved-combining-coding/#findComment-536095 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.