PHP - $ değişken = değer1 veya value2

0 Cevap php
$val1 = false;
$val2 = 10;

$variable = $val1 || $val2;

yapar Yukarıdaki kod $variable = true.

Is there any operator in PHP that would make $variable take the value of $val2, if $val1 is false? I thought || would do this, but it only returns true if any of the values are true, or false if both are false...

0 Cevap