Variable is a very important thing in a programming language. Since most of the programming process is to process the data stored in the variable.
There are some rules that need to be considered in making a variable in PHP is:
Each variable is always preceded by a $ (dollar)
Allowed three types of characters are letters, numbers and underscores
The first character must be a letter or underscore
If a variable name is two, there should be no spaces in between.
Small and large letters will be different ( case sensitive )
Giving value to the variable
To assign a value to a variable, you can follow the formula as follows:
$variable_name = value of the data;
<?php $value1=12; //type data integer $value2=8.99; //type data float atau double $value3="Tes Nilai variabel string"; //type data string print "Tipe data integer : $value1<br>"; print "Tipe data double : $value2<br>"; print "Tipe data string : $value3"; ?>
Single and Double Quote
To display the data type string, we can use single or double quotes. To display double quotation marks itself way is as follows. Try the following data scripts.
<? php print "Bandung is known as \" the Flower City \ "";?>
Together with a variable constant but its value is fixed or permanent. By providing a constant value on the data type, we will not be able to vary the value. If we use data that are long and hard to remember constants should be used. The formula used is as follows:
An example of its use is as a script the following courses:
SITUS INI ADALAH SITUS PEMBELAJARAN PEMROGRAMAN DAN JUGA PEMAHAMAN TERHADAP TEKNOLOGI KOMPUTER. KALIAN BISA MENGIKUTI PEMBELAJARAN PEMROGRAMAN DENGAN BERTAHAP PADA MATERI YANG SUDAH SAYA SEDIAKAN, JIKA ADA MATERI YANG MEMBINGUNGKAN SILAKAN LAKUKAN KOMENTAR PADA MATERI YANG ANDA TANYAKAN ATAU KALIAN BISA MENGHUBUNGI SAYA DIHALAMAN KONTAK.