tags:

views:

188

answers:

6

For example: a is not smaller than b

How do i write this ?

+11  A: 
if ($a >= $b) 

if !($a < $b)
Josh Smeaton
+4  A: 

If a is not smaller than b, a is either greater than or equal to b so:

$a >= $b
ternaryOperator
+2  A: 

a >= b

Assuming that a and b are guaranteed to be comparable.

Thom Smith
Well i need this as i wrote it.
Jenphp
+3  A: 
!($a<$b)

Or simply

$a>=$b
Klaus
+3  A: 

Having an exclamation point outside of the condition causes a syntax error, doesn't it?

if(!($a < $b))

"IF NOT A SMALLER THAN B"

Makes the most linguistic sense compared to their question.

that is syntactically correct, the ! just inverts the expression
Paul Dragoonis
+1  A: 
if( $a >= $b ) {
    echo $a . " is not smaller than " . $b;
} else {
    echo $a . " is smaller than " . $b;
}
NAVEED