Home
Main Page

PHP Basic
Introduction
Syntax
Variables
Operators
If...Else
Switch
Arrays
Looping
Functions
Forms
GET
POST

PHP Advanced
Date
Include
File
File Upload
Cookies
Sessions
Mail
Secure Mail

MySQL Database
Introduction
Connect
Create
Insert
Select
Where
Order By
Update
Delete

PHP Database
ODBC

PHP Reference
PHP Manual

PHP Operators



โอเปอร์เรเตอร์ (Operator) คือเครื่องหมายแทนการปฎิบัติการทางคณิตศาสตร์ หรือเปรียบเทียบ ข้างล่างนี้จะแจกแจงตัวโอเปอร์เรเตอร์ประเภทต่างๆ
Arithmetic Operators

Operator Description Example Result
+ บวก x=2
x+2
4
- ลบ x=2
5-x
3
* คูณ x=4
x*5
20
/ หาร 15/5
5/2
3
2.5
% โมดูลัส (หารเหลือเศษ) 5%2
10%8
10%2
1
2
0
++ การเพิ่ม x=5
x++
x=6
-- การลด x=5
x--
x=4
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

Operator Description Example
== เท่ากับ 5==8 ได้เป็น false
!= ไม่เท่ากับ 5!=8 ได้เป็น true
> มากกว่า 5>8 ได้เป็น false
< น้อยกว่า 5<8 ได้เป็น true
>= มากกว่า หรือเท่ากับ 5>=8 ได้เป็น false
<= น้อยกว่า หรือเท่ากับ 5<=8 ได้เป็น true
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




Related Sites
php.net
mysql
phpMyAdmin
apache
thainuke
microsoft
linux
PostgreSQL
Zend Technologies
CentOS

Special Thanks
ohohost.com
w3schools.com

Advertise




Power By



 
2278342







Copyright 2006 by Phpstreet. All Rights Reserved.