An array is a special variable, which can hold more than one value at a time. The array items are indexed with numbers, starting from 0. In PHP we can also index them with strings. These are called associative arrays. An array can contain other arrays as well.
Here is an array example in PHP:
$foods = array('pizza', 'lasagna', 'ravioli'); echo $foods; // outputs ravioli $foods = 'cheeseburger'; echo $foods; // outputs cheeseburger // associative array $foods = [ 'fruit' => 'apple', 'vegetable' => 'paprika' ]; echo $foods['fruit']; // outputs apple
var foods = ['pizza', 'lasagna', 'ravioli']; console.log(foods); // outputs ravioli foods.push('cheeseburger'); console.log(foods); // outputs cheeseburger