Minggu, 30 Oktober 2011

Contoh PHP

contoh php ++

<html>
<head>
<title>php plus</title>
</head>
<body>

<?php
 print("efek ++ sebagai akhiran :<br>\n");
 $x =77;
 printf("x= $x <br>\n");
 printf(2 + $x++);  print("<br>\n");
 printf("x= $x <br>\n");

 printf("efek ++ sebagai Awalan:<br>\n");
 $x =77;
 printf("x= $x <br>\n");
 printf(2 + ++$x);  print("<br>\n");
 printf("x= $x <br>\n");

 printf("Contoh Operasi dengan -- :<br>\n");
 $x =77;
 printf("x= $x <br>\n");
 $x--;
 printf("x= $x <br>\n");
?>

</body>
</html>

======================================


Bilangan Binier di PHP

<html>
<head>
</head>
<body>
<?php
 $bil1 =10;
 $bil1 =12;

 printf("%d & %d = %d <BR> \n", $bil1, $bil2, $bil1 & $bil2);
 printf("%d | %d = %d <BR> \n", $bil1, $bil2, $bil1 | $bil2);
 printf("%d ^ %d = %d <BR> \n", $bil1, $bil2, $bil1 ^ $bil2);
 printf("%d >> 1 = %d <BR> \n", $bil1, $bil1 >> 1);
 printf("%d >> 2 = %d <BR> \n", $bil1, $bil1 >> 2);
 printf("%d << 1 = %d <BR> \n", $bil1, $bil1 << 1);
 printf("%d << 2 = %d <BR> \n", $bil1, $bil1 << 2);
?>
</body>
</html>
Share This
Subscribe Here

0 comments :

Posting Komentar

 

Site Info

Followers

Indahnya Berbagi Copyright © 2009 BeMagazine Blogger Template is Designed by Blogger Template
In Collaboration with fifa