Remember basic arithmetic from school? These work just like those.
Example | Name | Result |
---|---|---|
+$a |
Identity | Conversion of $a to int or float as appropriate. |
-$a |
Negation | Opposite of $a. |
$a + $b |
Addition | Sum of $a and $b. |
$a - $b |
Subtraction | Difference of $a and $b. |
$a * $b |
Multiplication | Product of $a and $b. |
$a / $b |
Division | Quotient of $a and $b. |
$a % $b |
Modulo | Remainder of $a divided by $b. |
$a ** $b |
Exponentiation | Result of raising $a to the $b'th power. |
The division operator /
returns a float
value unless the two operands are int (or
numeric strings
which are type juggled to int) and the numerator is a multiple
of the divisor, in which case an integer value will be returned.
For integer division, see intdiv().
Operands of modulo are converted to int before processing. For floating-point modulo, see fmod().
The result of the modulo operator %
has the same sign
as the dividend — that is, the result of $a % $b
will have the same sign as $a. For example:
Example #1 The Modulo Operator
<?php
var_dump(5 % 3);
var_dump(5 % -3);
var_dump(-5 % 3);
var_dump(-5 % -3);
?>
The above example will output:
int(2) int(2) int(-2) int(-2)
鼻尖长痘是什么原因 | 龙胆泻肝丸治什么病 | 寸脉弱是什么原因 | 天使综合征是什么病 | 心脏搭桥后最怕什么 |
银杏叶片治什么病 | 副军长是什么军衔 | 脐带血有什么用 | 叩拜是什么意思 | 吃什么精力旺盛有精神 |
霍山石斛有什么作用 | 窝里横是什么意思 | 注音是什么意思 | 利多卡因是什么 | 肠胀气是什么原因引起的怎么解决 |
2023年五行属什么 | 早上起床想吐是什么原因 | 手指发麻是什么原因 | 低血压吃什么水果 | 101什么意思 |
子宫下垂有什么症状hcv8jop0ns6r.cn | 艾叶煮水喝有什么功效hcv7jop7ns4r.cn | 茂密的枝叶像什么hcv9jop2ns3r.cn | 颠三倒四是什么意思hcv9jop6ns3r.cn | 白果有什么功效hcv7jop5ns2r.cn |
hardly什么意思hcv8jop9ns0r.cn | 女人眉心有痣代表什么hcv9jop3ns9r.cn | 兔爷是什么意思hcv9jop3ns9r.cn | 脚后跟干裂起硬皮用什么药hcv8jop2ns1r.cn | 三尖瓣少量反流是什么意思xianpinbao.com |
惜字如金是什么意思hcv7jop5ns3r.cn | 十指纤纤尽夸巧是什么生肖hcv8jop1ns7r.cn | 交社保有什么用jasonfriends.com | 什么是法西斯主义zsyouku.com | 项羽为什么叫西楚霸王0297y7.com |
孕妇现在吃什么水果好hcv8jop8ns3r.cn | 为什么会一直流鼻涕hcv9jop5ns4r.cn | 继承衣钵是什么意思hcv8jop4ns1r.cn | pears是什么意思hcv9jop3ns4r.cn | rpl是什么意思hcv8jop2ns7r.cn |