You Now Here »

tutorial basic PHP operator aritmatika jumlah, kurang, kali, bagi, modulus  (Read 2514 times - 62 votes) 

DANNY

G-Plus Author
  • ADMINISTRATOR
  • More Share Forum Topic
  • [MS] kepala suku
  • *
  • DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!DANNY sangat terkenal!
  • Rep Power: 6
  • Join: September 30, 2009
  • Posts: 11,931
  • Poin: 193.409
    • WWW
  • IP member tracker Logged


Operator Aritmatika

Operator   Deskripsi   Contoh   Hasil

+   Penambahan   3 + 4  = 7
-   Pengurangan   12 - 6 = 6
*   Pengalian   3 * 3 = 9
/   Pembagian   4 / 2 = 2

%   Modulus (sisa hasil pembagian)   
5 % 2 =1
10 % 8 =2
10 % 2 =0   

++   Penambahan satu satu   x = 6
x++   x = 7
--   Pengurangan satu satu   x = 9
x--   x = 8

Contoh :

Quote
Code: [Select]
<?php
$x 
10;
$y 4;

$a $x $y;
echo 
$a."<br>";        //hasilnya 14

$b $x $y;
echo 
$b."<br>";        //hasilnya 6

$c $x $y;
echo 
$c."<br>";        //hasilnya 40

$d $x $y;
echo 
$d."<br>";        //hasilnya 2.5

$e $x $y;
echo 
$e."<br>";        //hasilnya 2
?>

thanx to
  :beer:


View Mobile Web Short URL: