Array functions to menimpan several different values that variable the same dala 1.
What is Array?
Create a variable to store the value in the form of text or numbers and can only issue one variable you store a value of either text or numbers.
Array is a special variable that can hold a variety of values in one variable.
EXAMPLE:
$ menu1 = 'Meatballs';
$ menu2 = 'fried rice';
$ menu3 = 'Burger';
If we want to write 300 menu then we must manus 300 different variable names, but we only need one array variable name to store 300 different values.
Writing in the array must start from the number 0.
The types of writing array:
$ menu [0] = 'Meatballs';
$ menu [1] = 'fried rice';
$ menu [2] = 'Burger';
$ menu = array ('meatballs' =>' Meatballs', 'nasgor' => 'fried rice', 'burger' =>' Burger ');
echo $ menu ['meatballs']. '&'. $ menu ['nasgor']. 'is the cuisine of Indonesia', / / it will be printed Meatballs & Indonesian fried rice is cooking.
No comments:
Post a Comment