ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: PHP :: PHP²Ù×÷·û

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

PHP
WINDOWSϰ²×°MyS..
PHP ÖÆ×÷ ÍøÕ¾/·þ..
ÓÃPHPºÍCSSÖÆ×÷»î..
PHP µ¥¼þģʽ
PHP MVCģʽ£¬Àà·..
PHP ÖÐʹÓÃÕýÔò±í..
PHP ·ÀÖ¹ SQL ×¢È..
PHP ¿çÕ¾µã½Å±¾¹¥..
PHP ·ÀÖ¹Óû§²Ù×Ý..
PHP ·ÀÖ¹Ô¶³Ì±íµ¥..

PHP²Ù×÷·û


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-28 ä¯ÀÀ:7796 :: ::

Operators are used to operate on values.
²Ù×÷·û£¨Operator£©ÊÇÓÃÀ´¶ÔÒ»¸öÖµ½øÐвÙ×÷µÄ¡£


PHP Operators
PHP²Ù×÷·û£¨Operator£©

This section lists the different operators used in PHP.
ÏÂÃæµÄÁбíÂÞÁÐÁËPHPÖв»Í¬µÄ²Ù×÷·û£¬ÒÔ¼°ËüÃDz»Í¬µÄÓ÷¨£º

Arithmetic Operators
ÔËËã·û£¨Arithmetic Operators£©

Operator
·ûºÅ
Description
ÃèÊö
Example
°¸Àý
Result
½á¹û
+ Addition
¼ÓºÅ
x=2
x+2
4
- Subtraction
¼õºÅ
x=2
5-x
3
* Multiplication
³ËºÅ
x=4
x*5
20
/ Division
³ýºÅ
15/5
5/2
3
2.5
% Modulus (division remainder)
ÇóÄ££¨ÓàÊý£©
5%2
10%8
10%2
1
2
0
++ Increment
×Ô¼Ó
x=5
x++
x=6
-- Decrement
×Ô¼õ
x=5
x--
x=4

Assignment Operators
·ÖÅä·û£¨Assignment Operators£©

Operator
·ûºÅ
Example
°¸Àý
Is The Same As
µÈͬÓÚ
= x=y x=y
+= x+=y x=x+y
-= x-=y x=x-y
*= x*=y x=x*y
/= x/=y x=x/y
%= x%=y x=x%y

Comparison Operators
±È½Ï·û£¨Comparison Operators£©

Operator
·ûºÅ
Description
¾ßÌåÃèÊö
Example
°¸Àý
== is equal to
µÈÓÚ
5==8 ·µ»Ø false
!= is not equal
²»µÈÓÚ
5!=8 ·µ»Ø  true
> is greater than
´óÓÚ
5>8 ·µ»Ø  false
< is less than
СÓÚ
5<8 ·µ»Ø  true
>= is greater than or equal to
´óÓÚµÈÓÚ
5>=8 ·µ»Ø  false
<= is less than or equal to
СÓÚµÈÓÚ
5<=8 ·µ»Ø  true

Logical Operators
Âß¼­ÅжϷû£¨Logical Operators£©

Operator
·ûºÅ
Description
ÃèÊö
Example
°¸Àý
&& and
Óë
x=6
y=3

(x < 10 && y > 1) ·µ»Ø true

|| or
»ò
x=6
y=3

(x==5 || y==5) ·µ»Ø false

! not
·Ç
x=6
y=3

!(x==y)·µ»Øtrue

ÆÀÂÛ (0) All