PHP Assignment Operators
The PHP assignment operators are used with numeric values to write a value to a variable.
The basic assignment operator in PHP is "=". It means that the left operand gets set to the value of the assignment expression on the right.

Assignment
Same as...
Description
x = y
x = y
The left operand gets set to the value of the expression on the right
x += y
x = x + y
Addition
x -= y
x = x - y
Subtraction
x *= y
x = x * y
Multiplication
x /= y
x = x / y
Division
x %= y
x = x % y
Modulus

Example:
<html>
    <head>
        <title>Assignment Operators</title>
    </head>
    <body>
        <h1>Assignment Operators</h1>
      

        <?php
        echo $x += 33; //$x=$x+33
        echo "<br>" . $x -= 33;                //$x=$x-33
        echo "<br>" . $x *= 33;               //$x=$x*33
        echo "<br>" . $x /= 33;             //$x=$x/33
        echo "<br>" . $x %= 33;         //$x=$x%33
        $msg = "<br>Some Errors";
        $msg .= "<br>Email is not valid";
        $msg .= "<br>Password is not valid";
        echo $msg;
        ?>
    </body>
</html>

No comments:

| Designed by Harhiktech