Theformalmethodofcreatinganarrayis & nbsp; tousethearray () function. Itssyntaxis: $ listarray ('appes', 'banas', & nbsp; 'oranges'); Arraysautomati
The formal method of creating an array is? To use the array () function. Its syntax is:
$ List = array ('append', 'banas ',? 'Oranges ');
Arrays automatically begin their indexing? At 0, unless otherwise specified. In that? Example-which doesn' t specify an index? For the elements-the first item, apples, is automatically indexed at 0, the second? Item at 1, and the third at 2 .? You can assign the index when using? Array ():
$ List = array (1 => 'append', 2 =>? 'Banas', 3 => 'oranges ');
Because PHP is very liberal when it comes? To blank space in your scripts, can you? Make this structure easier to read? Writing it over multiple lines:
$list = array ( 1 => 'apples', 2 => 'bananas', 3 => 'oranges');
Finally, the index value you specify doesn't? Have to be a number-you can use strings? As well. This indexing technique is practical
For making more meaningful lists. As? Example, you cocould create an array that? Records the soup of the day for each day? Of the week, as in the following script. This? Example will also demonstrate how you? Can, and cannot, print out an array (which? Has already been demonstrated but is? Worth rehashing ).