PHP also having operators like other programming Languages like Java, C++, and C etc.

PHP operators are:-

  • Assignment Operators.
  • Arithmetic’s Operators.
  • Comparison Operators.
  • String Operators.

Assignment Operators:

PHP having assignment operators i.e. (=) 


$a= 4;
$b = $a;

Arithmetic’s Operators:

PHP Arithmetic’s Operators are: +,-,*,/,%.


$c=$a+$b; (addition of two variables)
$d=$a-$b; (Subtraction of two variables)
$d=$a*$b; (Multiplication of two variables)
$d=$a/$b; (Division of two variables)


Comparison Operators:

PHP Comparison Operators are: ==, != , , =.


$a==$b; (Comparison of two variables)
$a! =$b; (addition of two variables)

String Operators:

PHP Strings Operators are: 

There are generally tow String Operators in PHP

  • First is a concatenation Operators (‘.’).
  • The Second one is Assignment Operators (‘=’)


PHP Conditional Statements

PHP Conditional operators are:

  • IF Statement.
  • IF..ElSE Statement.
  • IF..ELSEIF….Statement
  • Switch Statement. 

IF Statement: Like other programming language IF statement executes some statement when some particular condition is true.

Syntax: If (condition)

Code Execute;


IF..Else Statement: IF statement is true then execute one statement otherwise execute second statement.


IF (condition)
Code1 Execute;
Code2 Execute; 


IF..ELSEIF….Statement : If some condition is true then execute one statement else if some another statement then execute another statement. It is particularly an if else ladder.


Code1 Execute;
Code2 Execute; 


Switch Statement: To overcome the multiple If-Else statement problems we used switch statement. It is conditional statement are used to perform different action based on different conditions.

Working of Switch Statement: It takes one variable as input and checks it against all the different cases you set for the switch statements.


Switch (n)
            Case Lable1:
            Code to be executed when n=lable1;
            Case Lable2:
            Code to be executed when n=lable2;
            Case Lable3:
            Code to be executed when n=lable3;
            Condition fail;

Like it on Facebook, Tweet it or share this article on other bookmarking websites.

Comments (0)

There are no comments posted here yet

What will you do if oneday the natural food disappears

Suppose if one day the natural food / vegetation ie rice, daal etc etc disappears and nothing left to eat except other living beings, what will u do to eat ?
No answer selected. Please try again.
Please select either existing option or enter your own, however not both.
Please select minimum 0 answer(s) and maximum 5 answer(s).
[{"id":"18375","title":"I will eat Fish for the rest of my life","votes":"76","type":"x","order":"0","pct":25.85,"resources":[]},{"id":"18376","title":"I will fast and die eventually","votes":"40","type":"x","order":"0","pct":13.61,"resources":[]},{"id":"18377","title":"I will kill other beings and eat","votes":"24","type":"x","order":"0","pct":8.16,"resources":[]},{"id":"18378","title":"I dont know what to do","votes":"34","type":"x","order":"0","pct":11.56,"resources":[]},{"id":"18379","title":"depends upon the situation","votes":"120","type":"x","order":"0","pct":40.82,"resources":[]}] ["#ff5b00","#4ac0f2","#b80028","#eef66c","#60bb22","#b96a9a","#62c2cc"] ["rgba(255,91,0,0.7)","rgba(74,192,242,0.7)","rgba(184,0,40,0.7)","rgba(238,246,108,0.7)","rgba(96,187,34,0.7)","rgba(185,106,154,0.7)","rgba(98,194,204,0.7)"] 350
bottom 200
No married couple wants to end up getting divorced. It is not like they have planned for it. They try to put up with their partners for as long as they
Due to our modern lifestyle, we feel that digestion related disorders are a common problem. Thus, we neither give importance to them nor seek any help
The bond of marriage brings the two people together. Initially, everything may seem okay and both of them slowly start discovering each other in the journey.
In a seminar which I attended at the NDC in Delhi, speaker after speaker cautioned the Indian leadership about the growing danger to India from our immediate
Johny was skating down the road on his skateboard, swerving away from the curb, bustling through the traffic... The sun in the sky, the gentle wafting
Donald Trump won the election but lost the popular vote. This is the dichotomy of the American election where it is not the case of first past the post.
Narendra Modi swept to power in a gigantic wave, not seen for over 3 decades as he beat the moth-eaten UPA government led by the lackey of the Nehru- Gandhi
Introduction  We all have a powerful desire in our mind to see the unseen and to know the unknown. As a result we spontaneously seek for travelling