Why is this if statement returning false every time?

Ali Zia

I have a piece of code. It is returning false every time, despite the fact that condition is true. Where am I wrong?

$a = 5;
$b = 10;
$c = 15;

if( ($c > $b) > $a){
    echo "yes";
} else {
    echo "no";
}
Sougata Bose

For your data

($c > $b) is true.

true > $a is false.

var_dump(100 < TRUE); // FALSE - same as (bool)100 < TRUE
var_dump(-10 < FALSE);// FALSE - same as (bool)-10 < FALSE

Comparison Operators

Should be -

if( ($c > $b) && ($c> $a)) {

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why is this if statement returning false every time?

From Dev

Why is this else statement printing every time?

From Dev

PHP - Select statement by username is returning 0 every time?

From Dev

PDO Statement returning false

From Dev

if statement always returning false

From Dev

Why is this code NOT returning false?

From Dev

Why is this Regex returning false?

From Dev

Batch IF statement always returning false?

From Dev

PHP IF statement with Date not returning False

From Dev

If statement in C always returning false

From Dev

indexOf("-") returning - 1 every time

From Dev

rangeOfString returning not nil every time

From Dev

sqlite3_step(statement) == SQLITE_DONE returning false all the time

From Dev

Why is this statement false?

From Dev

Error in php sql statement ($stmt2 is returning false but I dont know why)

From Dev

Java: if and else returning true or false at every condition

From Dev

Why is typeid always returning false?

From Dev

Statement is returning false when it shouldn't

From Dev

PHP MySQLI prepared statement returning false on execution

From Dev

If statement for ViewHolder is returning false all everytime

From Dev

Prepared statement returning false but query was successful

From Dev

Why is this if statement always returning true

From Dev

Why is this if statement always returning true

From Dev

Why is this if statement returning something contradictory?

From Dev

Why is my if statement always false?

From Dev

Why is the inverted if-statement false?

From Dev

/dev/urandom returning same value every time

From Dev

JQuery .is :checked returns false every time

From Dev

Cakephp 3.0 Login returns false every time

Related Related

HotTag

Archive