القائمة الرئيسية

الصفحات

 PHP - Operator



What is Operator?

 Simple answer can be given using expression 4   5 is equal to 9. Here 4 and 5 are called operands and   is called operator. PHP language supports following type of operators.  Arithmetic Operators Comparison Operators Logical (or Relational) Operators Assignment Operators Conditional (or ternary) Operators Lets have a look on all operators one by one.  Arithmetic Operators There are following arithmetic operators supported by PHP language −  Assume variable A holds 10 and variable B holds 20 then −  Show Examples

ما هو المشغل؟

 يمكن إعطاء إجابة بسيطة باستخدام التعبير 4 5 يساوي 9. هنا 4 و 5 تسمى المعاملات وتسمى عامل التشغيل. تدعم لغة PHP الأنواع التالية من عوامل التشغيل. العوامل الحسابية مقارنة عوامل التشغيل المنطقية (أو العلائقية) عوامل التعيين الشرطية (أو الثلاثية) المشغلون دعنا نلقي نظرة على جميع العوامل واحدًا تلو الآخر. العوامل الحسابية هناك عوامل تشغيل حسابية تدعمها لغة PHP - افترض أن المتغير A يحمل 10 ومتغير B يحمل 20 
OperatorDescriptionExample
+Adds two operandsA + B will give 30
-Subtracts second operand from the firstA - B will give -10
*Multiply both operandsA * B will give 200
/Divide numerator by de-numeratorB / A will give 2
%Modulus Operator and remainder of after an integer divisionB % A will give 0
++Increment operator, increases integer value by oneA++ will give 11
--Decrement operator, decreases integer value by oneA-- will give 9

Comparison Operators

 There are following comparison operators supported by PHP language  Assume variable A holds 10 and variable B holds 20 then −  Show Examples

عوامل المقارنة

 هناك عوامل المقارنة التالية مدعومة بلغة PHP افترض أن المتغير A يحمل 10 ومتغير B يحمل 20 ثم - 
OperatorDescriptionExample
==Checks if the value of two operands are equal or not, if yes then condition becomes true.(A == B) is not true.
!=Checks if the value of two operands are equal or not, if values are not equal then condition becomes true.(A != B) is true.
>Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.(A > B) is not true.
<Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.(A < B) is true.
>=Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.(A >= B) is not true.
<=Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.(A <= B) is true.

Logical Operators

 There are following logical operators supported by PHP language  Assume variable A holds 10 and variable B holds 20 then −

العوامل المنطقية 

هناك عوامل تشغيل منطقية مدعومة بلغة PHP افترض أن المتغير A يحمل 10 والمتغير B يحمل 20 ثم -
OperatorDescriptionExample
andCalled Logical AND operator. If both the operands are true then condition becomes true.(A and B) is true.
orCalled Logical OR Operator. If any of the two operands are non zero then condition becomes true.(A or B) is true.
&&Called Logical AND operator. If both the operands are non zero then condition becomes true.(A && B) is true.
||Called Logical OR Operator. If any of the two operands are non zero then condition becomes true.(A || B) is true.
!Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.!(A && B) is false.
هل اعجبك الموضوع :

تعليقات