文、意如
一、數學運算子 + - * / // ** %
二、指定運算子 = += -= *= /=
三、比較運算子 == >= <= !=
四、邏輯運算子 && || !
五、全等 ===
一、數學運算子 + - * /

<?php
//了解運算子
$x = 10;
$y = 6;
echo $x+$y."<br>";
echo $x-$y."<br>";
echo $x*$y."<br>";
echo $x/$y."<br>";
echo $x%$y."<br>";
echo "=====<br>";
echo $x."+".$y."=".($x+$y);
?>
二、指定運算子 = += -= *= /=

<?php
//指定運算子
$x = 5;
echo $x."<br>";//5
$x += 3;//5+3=8
echo $x."<br>";//8
$x -= 2;//8-2=6
echo $x."<br>";//6
$x *= 3;//6*3=18
echo $x."<br>";//18
?>
三、比較運算子 == >= <= !=

<?php
#比較運算子
#布林只有兩種值(true) 或者(false)
#true 代表為真、成立、數字代表為 1
#false 代表為假、不成立、數字代表為 0
$a = 5;
$b = 7;
var_dump ($a == $b); #false
var_dump ($a > $b); #false
var_dump ($a <= $b); #true
var_dump ($a != $b); #true
?>
四、邏輯運算子 and or not


試著做做看


五、$a === $b
如果 $a 等於 $b,類型也要相同
Yiru@Studio - 關於我 - 意如