Minggu, 30 Oktober 2011

Konstanta PHP


Konstanta

Konstanta mirip dengan variable. Bedanya nilai konstanta tidak pernah berubah sejak dideklarasikan. Untuk mendeklarasikan konstanta digunakan fungsi define().



Sintak :
    define("nama_konstanta",nilai);

Contoh Program PHP dengan Konstanta :

<?php
 define("phi",3.14) ;
 $r = 5;
 $luas = phi * $r * $r ;
 echo "Luas = $luas" ;
?>
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