خرید بک لینک

Vote count: 0

I am having trouble understanding the behavior of the 'and' PHP operator.

Here is the code:

$condition1 = true;
$var2 = "var2";
$var3 = "var3";

$condition2 = $condition1 and $var2 == $var3;

if($condition2)
    echo '$condition1 and $var2 == $var3';

Output: $condition1 and $var2 == $var3

Now it is obvious that since $var2 != $var3, $condition2 should be false. Hence the echo statement should not be executed but it happens the other way. Can any one tell me what's wrong with this code?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 10 مرداد 1395 ساعت: 14:00

صفحه بندی