Variable pada PHP direpresentasikan oleh karakter dollar ($) dan dilanjutkan dengan nama variable tersebut. Variable pada PHP bersifat case-sensitive. Nama variable yang valid pada php dimulai dengan huruf atau underscore (_) dan diikuti oleh huruf, angka atau underscore. Jika dilihat sebagai regular expression:
[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
Huruf terdiri dari a sampai z dan A sampai Z, karakter ASCII dari 127 sampai 255 (0x7f sampai 0xff). Variable tidak boleh menggunakan tanda baca ataupun reserved word PHP, seperti print, echo.
Contoh :
<?php$a="5";$b="2.5";$komentar="Selamat Datang di PHP";echo ("Nilai variabel a adalah = $a <br>");//variabel bertipe integerecho ("Nilai variabel b adalah = $b <br>");//variabel bertipe realecho ("Nilai variabel komentar adalah = $komentar<br>");//variabel bertipe string$hasil=$a+$b;echo ("Hasil jumlah a dan b adalah = $hasil <br>"); //variabel bertipe double$tgl = date("d F Y"); //variabel bertipe tanggal$nama = "Politeknik Telkom";$garis= "=====================================";echo "<p>";echo $garis."<br>";echo $komentar. " Di Lab ". $nama. "<br>Belajar dengan giatya.... <br>";echo $garis."<br>";echo "Tanggal ".$tgl;?>
wah ribet sekali kayaknya bro regexnya..
mungkin bisa dipersimpel
salam
http://bayu-immanuel.blogspot.com/
mas dikasih tampilan contoh dunk biyar lebih bisa dipahami???
The casino is over. Let's say you're going to die in the casino
“There is a whole 동해 출장마사지 lot of excitement on your horizon,” says Wynn Resorts CEO Matt Maddox, 하남 출장마사지 as 오산 출장샵 he 광양 출장샵 walks through 경상북도 출장안마 the property,