Jump to content

[SOLVED] PHP Operator help needed


acctman

Recommended Posts

<?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 <

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.