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); } Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
acctman Posted May 8, 2008 Author Share Posted May 8, 2008 thanks Quote Link to comment 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 ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.