Phpda arifmetik amallar

Php da boshqa dasturlash tillari kabi o’xshash operatorlar mavjud.
+ – Qo’shish
–  – Ayirish
– Ko’paytirish
– Bo’lish
% – Qoldiqli bo’lish
** – darajaga ko’tarish
++ – inkrement
—  – dekrement

<?php
$a = 8; 

$b = 2; 

echo $a + $b; //10 

echo $a - $b; //6 

echo $a * $b; //16 

echo $a / $b; //4 

echo $a % $b; //0 

echo $a ** $b; //64

echo ++$a; //9 

echo --$b; //1 

?>

Yuqoridagi misolni ishlatib ko’rsangiz, hammasi bitta satrda chiqadi. Misolda ortiqcha kod chiqmasligi uchun <br/>kodi qo’shilmadi.

Agar gapda qandaydir xatolik topsangiz, Ctrl+Enter orqali xabar bering.

error: Content is protected !!

Spelling error report

The following text will be sent to our editors: