Visit the Official PHP Website |
PHP ProgrammingBy James N HitzCommon PHP OperatorsThere are so many PHP operators. A more thorough version with more detailed explanations is given here (click to open new window). Below we have extracted the list of the most common.
I know the above operators (save for the first one) may be making your head spin. Rest easy. I'll explain one of them after which the others will be a breeze. Supposing we have a variable $price which we assign the value 20: $price = 20; If we wanted to add a 5.00 storage charge to the price we would say that the new $price is the previous $price plus 5: $price = $price + 5;This can be "short-circuited" to read thus: $price += 5; This means the same as -=, /= and *= but with subtraction, division and multiplication respectively. Have we cleared the air now? Hope so. Now, Play (remember the Pause?)
If you want to have a better look at operators, click here (open's new window). Otherwise, I will assume you are okey and that things are fine. Come on {Shhh}no one will know you clicked{/Shhh}. Now... Back to Variables. |