PHP - Write program to define variable

Requirements

Write program to define variable

  • Write a script that creates a variable and assigns an integer value to it,
  • then adds 1 to the variable's value three times, using a different operator each time.
  • Display the final result to the user.

Demo

<?php
         $x = 5;//from  w w w. j a va 2s.  c o m
         $x = $x + 1;
         $x += 1;
         $x++;
         echo $x;
?>

Result

Related Exercise