acctman Posted May 8, 2008 Share Posted May 8, 2008 If $width is 640 but Greater Than 160 and $height is 480 but Greater than 120 Something like this I guess (that does not look right to me though) $width < 640 > 160 && $height < 480 > 120 thanks Link to comment https://forums.phpfreaks.com/topic/104777-solved-php-operator-help-needed/ Share on other sites More sharing options...
Fadion Posted May 8, 2008 Share Posted May 8, 2008 <?php if($width < 640 and $width > 160 and $height < 480 and $height > 120){ echo 'Yes u made it'; } else{ echo 'Naah'; } > Using the AND logical operator will return false if any of the conditions are not met. Guess thats how u wanted it. Link to comment https://forums.phpfreaks.com/topic/104777-solved-php-operator-help-needed/#findComment-536378 Share on other sites More sharing options...
acctman Posted May 9, 2008 Author Share Posted May 9, 2008 <?php if($width < 640 and $width > 160 and $height < 480 and $height > 120){ echo 'Yes u made it'; } else{ echo 'Naah'; } > Using the AND logical operator will return false if any of the conditions are not met. Guess thats how u wanted it. I'm checking the image size to detect if the size is in between 640-160 in width and height 480-120. how does the coding below look? if($width <= 640 and $width >= 160 and $height <= 480 and $height >= 120) { echo 'Image is 640x480 or less and/or greater that 160x120, do not resize.' } else { echo 'Image is greater than 640x480 (needs resizing) or Less than 160x120 its too small' } correction: i wrote greater in my first post when i meant less < Link to comment https://forums.phpfreaks.com/topic/104777-solved-php-operator-help-needed/#findComment-536476 Share on other sites More sharing options...
Fadion Posted May 9, 2008 Share Posted May 9, 2008 Except the missing semicolons in both your echo lines, it will work just fine. Link to comment https://forums.phpfreaks.com/topic/104777-solved-php-operator-help-needed/#findComment-536479 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.