// array() notation
array(value1, value2, value3, ...)

// [] notation
[index => value, index => value, index => value, ...]
// array() notation
array(index => value, index => value, index => value, ...)

// [] notation
[index => value, index => value, index => value, ...]
// array() notation
array(
    1,
    2,
    3, // A comma (,) after the last element is valid syntax.
);

// [] notation
[
    1,
    2,
    3, // A comma (,) after the last element is valid syntax.
];
// array() notation
$empty_array = array();

// [] notation
$empty_array = [];

print_r($empty_array);
// Output: Array ( )
// array() notation
$fruits = array('Apple', 'Banana', 'Cherry');

// [] notation
$fruits = ['Apple', 'Banana', 'Cherry'];

echo $fruits[0]; // Output: 'Apple'
echo $fruits[1]; // Output: 'Banana'
echo $fruits[2]; // Output: 'Cherry'
// array() notation
$ages = array("Peter" => 35, "Ben" => 37, "Joe" => 43);

// [] notation
$ages = ["Peter" => 35, "Ben" => 37, "Joe" => 43];

echo $ages["Peter"]; // Output: 35
echo $ages["Ben"];   // Output: 37
echo $ages["Joe"];   // Output: 43
// array() notation
$cars = array(
    array('Volvo', 22, 18),
    array('BMW', 15, 13),
    array('Saab', 5, 2),
    array('Land Rover', 17, 15)
);

// [] notation
$cars = [
    ['Volvo', 22, 18],
    ['BMW', 15, 13],
    ['Saab', 5, 2],
    ['Land Rover', 17, 15]
];

echo $cars[0][0]; // Output: 'Volvo'
echo $cars[1][0]; // Output: 'BMW'
echo $cars[2][0]; // Output: 'Saab'
echo $cars[3][0]; // Output: 'Land Rover'
// array() notation
$mixed_array = array(
    'name' => 'John',
    'age' => 30,
    'hobbies' => array('Soccer', 'Reading'),
    'address' => '123 Main Street'
);

// [] notation
$mixed_array = [
    'name' => 'John',
    'age' => 30,
    'hobbies' => ['Soccer', 'Reading'],
    'address' => '123 Main Street'
];

echo $mixed_array['name']; // Output: 'John'
echo $mixed_array['age']; // Output: 30
echo $mixed_array['hobbies'][0]; // Output: 'Soccer'
echo $mixed_array['hobbies'][1]; // Output: 'Reading'
echo $mixed_array['address']; // Output: '123 Main Street'