Exemple des opérateurs arithmétiques

Author:


Download

<html>
 <head>
  <title>Opérateur Arithmétique</title>
 </head>
 <body>
<?php

  $nombre1=20;
  $nombre2=30;
  $add =$nombre1 + $nombre2;
  $addstr="I love "."PHP";
  $sub = $nombre1 - $nombre2;
  $mul = $nombre1 * $nombre2;
  $mod = $nombre1 % $nombre2;
  $inc = $nombre1; $inc = ++$inc;
  $dec = $nombre2; $dec = --$dec;

  $resultat = "addition:$add  <br>";
  echo("<h3>".$resultat."</h3>");
  $resultat = "substraction:$sub       <br>";
  echo("<h3>".$resultat."</h3>");
  $resultat = "multiplication:$mul       <br>";
  echo("<h3>".$resultat."</h3>");
  $resultat = "modulo:$mod       <br>";
  echo("<h3>".$resultat."</h3>");
  $resultat = "incrémentation:$inc       <br>";
  echo("<h3>".$resultat."</h3>");
  $resultat = "décrémentation:$dec       <br>";
  echo("<h3>".$resultat."</h3>");
?>

 </body>
</html>

Leave a Reply

Your email address will not be published. Required fields are marked *


3 + = twelve