With what you have learned so far, you can assign data to variables. You can even investigate and change the *data type* of a *variable*. A *programming language* isn't very useful, though, unless you can manipulate the data you can store. * Operators* are symbols that make it possible to use one or more values to produce a new value. A value that is operated on by an operator is referred to as an operand.

- An operator is a symbol or series of symbols that, when used in conjunction with values, performs an action and usually produces a new value.
- An operand is a value used in conjunction with an operator. There are usually two operands to one operator.

**1). Assignment Operators**

**2). Arithmetic Operators **

**3). Comparison Operators **

**4). Logical Operators **

The basic ** assignment operator** is "=". Your first inclination might be to think of this as "equal to". Don't. It really means that the the left operand gets set to the value of the expression on the rights (that is, "gets set to").

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 |

%= | x%=y | x=x%y |

The value of an *assignment expression* is the value assigned. That is, the value of "$a = 3" is 3. This allows you to do some tricky things:

**PHP Example:-**

<?php

$a = ($b = 4) + 5; // $a is equal to 9 now, and $b has been set to 4.

?>

Go Top $a = ($b = 4) + 5; // $a is equal to 9 now, and $b has been set to 4.

?>

The *arithmetic operators* do exactly what you would expect—they perform *arithmetic operations*.

- The
*addition operator*(+) adds the right operand to the left operand. - The
*subtraction operator*(-) subtracts the right-hand operand from the left. - The
*division operator*(/) divides the left-hand operand by the right. - The
*multiplication operator*(*) multiplies the left-hand operand by the right. - The
*modulus operator*(%)returns the remainder of the left operand divided by the right.

*Remember basic arithmetic from school ? These work just like those.*

Operator | Example | Result |
---|---|---|

Addition (+) | $a + $b | Sum of $a and $b. |

Subtraction (-) | $a - $b | Difference of $a and $b. |

Multiplication (*) | $a * $b | Product of $a and $b. |

Division (/) | $a / $b | Quotient of $a and $b. |

Modulus (%) | $a % $b | Remainder of $a divided by $b. |

**Tips:-**

- The division operator ("/") returns a float value anytime, even if the two operands are integers (or strings that get converted to integers).

The *comparison operators* perform tests on their operands. They return the *Boolean value* true if the test is successful, or false otherwise. This type of expression is useful in *control structures*, such as if and while statements.

Operators | Example | Result |
---|---|---|

Equal (==) | $a == $b | TRUE if $a is equal to $b. |

Identical (===) | $a === $b | TRUE if $a is equal to $b, and they are of the same type. (PHP 4 only) |

Not equal (!=) | $a != $b | TRUE if $a is not equal to $b. |

Not equal (<>) | $a <> $b | TRUE if $a is not equal to $b. |

Not identical (!==) | $a !== $b | TRUE if $a is not equal to $b, or they are not of the same type. (PHP 4 only) |

Less than (<) | $a < $b | TRUE if $a is strictly less than $b. |

Greater than (>) | $a > $b | TRUE if $a is strictly greater than $b. |

Less than or equal to (<=) | $a <= $b | TRUE if $a is less than or equal to $b. |

Greater than or equal to (>=) | $a >= $b | TRUE if $a is greater than or equal to $b. |

The *logical operators* test combinations of Booleans. For example, the or operator, which is indicated by two *pipe characters* (||) or simply the word or, returns true if either the left or the right operand is true:

**true || false **

This expression returns true.

Name | Example | Result |
---|---|---|

And (&&) | $a and $b | TRUE if both $a and $b are TRUE. |

Or (||) | $a or $b | TRUE if either $a or $b is TRUE. |

Xor | $a xor $b | TRUE if either $a or $b is TRUE, but not both. |

Not (!) | ! $a | TRUE if $a is not TRUE. |

- Working with Forms
- Security Measures
- Verification Strategies
- $_POST, $_GET, $_REQUEST, and $_FILES
- Form Handling
- Form Validation
- Super Global Variables
- Superglobal Variables and Register_Globals
- Server Variables
- A Script to Acquire User Input
- Accessing Form Input with User Defined Arrays
- Using Hidden Fields to Save State
- Redirecting the User
- Using header() to Send Raw Headers
- File Upload Forms and Scripts
- A Simple File Upload Form
- Table File Upload Global Variables
- A File Upload Script
- Distinguishing Between GET and POST Transactions
- Combining HTML and PHP Code on a Single Page
- Summary
- Workshop

- Introduction to Database Programming
- Introduction to SQL
- RDBMS
- The SQL Language
- The Role of SQL
- SQL Features and Benefits
- Create a Connection to a MySQL Database
- Closing a Connection
- Select Data From a Database Table
- Display the Result in an HTML Table
- Insert Data Into a Database Table
- Insert Data From a Form Into a Database
- Update Data In a Database
- Execute Multiple MySQL Queries from One String in PHP

?IT guy – (Asks worker) What do you have?

Daily Wage Construction Worker – …….stays * quite*

IT guy – I have Money, Name, Stock Options What do

you have?

Daily Wage Construction Worker – (Softly) I have work.

?Software is like entropy: It is difficult to grasp, weighs nothing, and obeys the Second Law of Thermodynamics; i.e., it always increases.