Sunday, 22 June 2014

PHP Operators

PHP Arithmetic Operators:-

Operator
Name
Example
Result
+
Addition
$x + $y
Sum of $x and $y
-
Subtraction
$x - $y
Difference of $x and $y
*
Multiplication
$x * $y
Product of $x and $y
/
Division
$x / $y
Quotient of $x and $y
%
Modulus
$x % $y
Remainder of $x divided by $y

PHP String Operators:-

Operator
Name
Example
Result
.
Concatenation
$txt1 = "Hello"
$txt2 = $txt1 . " world!"
Now $txt2 contains "Hello world!"

PHP Increment / Decrement Operators:-

Operator
Name
Description
++$x
Pre-increment
Increments $x by one, then returns $x
$x++
Post-increment
Returns $x, then increments $x by one
--$x
Pre-decrement
Decrements $x by one, then returns $x
$x--
Post-decrement
Returns $x, then decrements $x by one

PHP Logical Operators:-

Operator
Name
Example
Result
&&
And
$x && $y
True if both $x and $y are true
||
Or
$x || $y
True if either $x or $y is true
!
Not
!$x
True if $x is not true


Related Posts:

  • Types of CSS Chapter 1 : Introduction to CSS A CSS (cascading style sheet) file allows you to separate your web sites (X)HTML content from it’s style. As always… Read More
  • How does CSS work? In this lesson you will learn how to make your first style sheet. You will get to know about the basic CSS model and which codes are necessary to us… Read More
  • CSS Syntax CSS syntax comprises a few fundamental pieces; rules, selectors, declarations, properties and values. This CSS rule contains all the other bits and… Read More
  • Introduction to CSS C.S.S. stands for Cascading Style Sheets; documents which contain styling rules for applying to HTML (or XML, along with a few other structural… Read More
  • PHP Operators PHP Arithmetic Operators:- Operator Name Example Result + Addition $x + $y Sum of $x and $y - Subtr… Read More