Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

PHP Assignment Operators Example

<html>
   
   <head>
      <title>Assignment Operators</title>
   </head>
   
   <body>
      
      <?php
         $a = 42;
         $b = 20;
         
         $c = $a + $b;   /* Assignment operator */
         echo "Addtion Operation Result: $c <br/>";
         
         $c += $a;  /* c value was 42 + 20 = 62 */
         echo "Add AND Assigment Operation Result: $c <br/>";
         
         $c -= $a; /* c value was 42 + 20 + 42 = 104 */
         echo "Subtract AND Assignment Operation Result: $c <br/>";
         
         $c *= $a; /* c value was 104 - 42 = 62 */
         echo "Multiply AND Assignment Operation Result: $c <br/>";
         
         $c /= $a;  /* c value was 62 * 42 = 2604 */
         echo "Division AND Assignment Operation Result: $c <br/>";
         
         $c %= $a; /* c value was 2604/42 = 62*/
         echo "Modulus AND Assignment Operation Result: $c <br/>";
      ?>
      
   </body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.