Sunday, February 6, 2011

වෙබ් අඩවි සංවර්ධනය හයවන පාඩම.....

කොහොමද යාලුවනේ දැ ඔයාලගෙ PHP විචල්‍ය ගැන දැනුම එහෙම? කලින් පාඩමෙන් කිව්වා වගේ අද මම ඔයාලට PHP Operators ගැන කියල දෙන්නයි හදන්නෙ.


අපිට පරිගණක භාෂා භාවිතා කරනකොට විවිධ වටිනාකම් (Values), තර්ක (logics) සමග වැඩ කරන්න වෙනවා. එවත් සමග වැඩ කරන විට මෙ කියන Operators කියන දේවල් ගොඩාක් ප්‍රයෝජනවත් වෙනවා.


Operators වර්ග කීපයක් තියෙනවා.

  • Arithmetic Operators
  • Assignment Operators
  • Logical Operators
තමයි ඒ  Operators.

මහත දක්වා ඇති පරිදි ඔයාලට එම Operators හදුනාගෙන අධ්‍යනය කරන්න පුලුවන්.





Arithmetic Operators

OperatorDescriptionExampleResult
+Additionx=5
x+5
10
-Subtractionx=6
9-x
3
*Multiplicationx=11
x*3
33
/Division40/10
13/2
4
6.5
%Modulus (division remainder)9%2
22%6
30%2
1
4
0
++Incrementx=2
x++
x=3
--Decrementx=6
x--
x=5






Assignment Operators

OperatorExampleIs The Same As
=x=yx=y
+=x+=yx=x+y
-=x-=yx=x-y
*=x*=yx=x*y
/=x/=yx=x/y
.=x.=yx=x.y
%=x%=yx=x%y




Comparison Operators

OperatorDescriptionExample
==is equal to9==2 returns false
!=is not equal9!=2 returns true
<>is not equal9<>2 returns true
>is greater than10>3 returns true
<is less than10<3 returns false
>=is greater than or equal to6>=7 returns false
<=is less than or equal to1<=5 returns true




Logical Operators

OperatorDescriptionExample
&&andx=8
y=4

(x < 9 && y > 6) returns false
||orx=8
y=4

(x==8 || y==5) returns true
!notx=8
y=4

!(x==y) returns true



ඉතින් යාලුවනේ ඔයාලට අද පාඩමෙන් ගැටළු අවොත් කියන්න.මම හත්වෙනි පාඩමෙන් මෙම Operators වලට උදාහරණ කීපයක් දෙන්නම්.එතෙක් අයුබෝවන්....!

1 comment: