lundi 4 mai 2015

PHP If Statement (regarding numerical values)

$a = 3;  
$b = $a++;

if ($a > $b) { echo “a > $b” }
else if ($a == $b) { echo “a = $b” }
else { echo “a < $b” }

When I work through this question, I get a=3, b=4 (3+1). Hence both the If and Else If conditions are false, so I go to Else and final answer is: a < 4.

However, the answer according to the mark scheme is: a > 3 meaning that the If condition is true. How could $a be larger than $b? Thanks

Aucun commentaire:

Enregistrer un commentaire