COMPUTER LEARNING CENTER
WWW.HUUKHANG.COM
$i=10;
$j=5;
$j+=$i++;
echo
"j=$j";
echo
"<br>";
echo
"i=$i";
echo
"<br>";
$j+=++$i;
echo "j=$j";echo "<br>";
?>
</BODY>
</HTML>
2.2.
Toaùn töû Not: ~ And !
Toaùn töû ~ ñaûo nghòch taát caû caùc bit cuûa tham soá, coøn toaùn töû ! ñaûo nghòch
giaù trò cuûa giaù trò tröôùc ñoù. Chaúng haïn trong tröôøng hôïp naøy chuùng ta söû duïng
cho bieåu thöùc hay bieán coù giaù trò boolean.
Ví duï 3.2: Pheùp toaùn ~ and !
<HTML>
<HEAD>
<TITLE>::Welcome to PHP</TITLE>
</HEAD>
<BODY>
<h4>~, ! Operator</h4>
<?php
$i=10;
$j=5;
$j+=~$i;
echo
"j=$j";
echo
"<br>";
$j+=~$i++;
echo
"i=$i";
echo
"<br>";
$j+=++$i;
echo
"j=$j";
echo
"<br>";
?>
</BODY>
</HTML>
2.3.
Toaùn töû nhaân vaø chia: * and /
Baïn coù theå tham khaûo ví duï sau
Ví duï 3.3: Pheùp toaùn * vaø /, + vaø -
<HTML>
<HEAD>
<TITLE>::Welcome to PHP</TITLE>
3-3