Pada simulasi ini saya akan memberikan contoh deklarasi variable di PHP. Adapun variabel di php bersifat objek, yaitu tidak perlu mendefnisikan tipe variabel, seperti integer, string, dll.
Berikut script nya :
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Lesson 2</title> </head> <body> <?php // sample string $sampleVarString = "hello world from variable"; // sample var int $sampleVarInt = 10; // sample var double $sampleVarDouble = 100.999; echo "contoh string : ".$sampleVarString."<br>"; echo "contoh int : ".$sampleVarInt."<br>"; echo "contoh double : ".($sampleVarDouble + 100)."<br>"; ?> </body> </html> |
Atau bisa dilihat simulasinya disini.
– marifnst –
Leave a Reply