Php program to print the array element

A Php program to print the array element in programming language. In this program we can print the array elements in php. An array is a data structure that includes a collection of elements. The data types of these things are frequently the same, such as an integer or a string. For example, a search engine might utilise an array to store Web sites discovered during a user’s search.

$fruit=array("apple","orange","strawberry","pineapple"); 
echo "Fruits are $fruit[0], $fruit[1], $fruit[2] and $fruit[3]";
?>

 

Output:

Fruits are apple, orange, strawberry and pineapple

What is array and how does it works

A data structure that contains one or more comparable types of values in a single value is known as an array. If you wish to store 100 numbers, for example, instead of declaring 100 variables, you may just construct an array of length 100. An array containing a numeric index is known as a numeric array. In a linear method, values are stored and accessed.