so the output will become: In the above example Variable( $x) with value=100. ($x*=10) now value 10 multiply with previous value(100). it gives remainder value=”1″ and this remainder assign again to variable($x). Now concatenate this string to another string using the same variable by performing ($str.=”to the world of php”).and the output will become:1000 and it re-assign back to the variable ($x) so the output will become : 1000 In the above example. now perform divide.($x/=500) now value 500 divide with previous value(1000). and the output will become : 1 In the above example. In the above example Initialize variable ($x) with value = 500. we don’t need a second and third variable to store the sum of value($x =500) it means ($x=$x 500 ) .
Print it out, write all over it, post your favorite lessons all over your wall!
Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time!
Else PHP - Elseif PHP - Switch PHP - Forms PHP - Functions PHP - Array PHP - While Loop PHP - For Loop PHP - For Each PHP - Do While PHP - POST & GET PHP - Magic Quotes PHP - htmlentities PHP Files PHP - File PHP - File Create PHP - File Open PHP - File Close PHP - File Write PHP - File Read PHP - File Delete PHP - File Append PHP - File Truncate PHP - File Upload PHP Strings PHP - strpos PHP - str_replace PHP - substr_replace PHP - Capitalization PHP - explode PHP - implode PHP Advanced PHP - Date PHP - Session PHP - Cookies Get Help!
However, with the pre-increment " $x" the variable does reflect the addition immediately.
If you would rather download the PDF of this tutorial, check out our PHP e Book from the store.
The downside to this combination operator is that it reduces code readability to those programmers who are not used to such an operator.
Here are some examples of other common shorthand operators.
In this tutorial you will learn how to manipulate or perform the operations on variables and values using operators in PHP.
Operators are symbols that tell the PHP processor to perform certain actions.