Indexed arrays store ordered values at numeric positions.

Indexed Arrays

indexed_arrays.php
<?php
$first = ;
$count = count([$first, "white", "black"]);
$selected = [$first, "white", "black"][1];

echo "first=" . $first . "\n";
echo "selected=" . $selected . "\n";
echo "count=" . $count . "\n";
<?php
$first = ;
$count = count([$first, "white", "black"]);
$selected = [$first, "white", "black"][1];

echo "first=" . $first . "\n";
echo "selected=" . $selected . "\n";
echo "count=" . $count . "\n";
<?php
$first = ;
$count = count([$first, "white", "black"]);
$selected = [$first, "white", "black"][1];

echo "first=" . $first . "\n";
echo "selected=" . $selected . "\n";
echo "count=" . $count . "\n";
array index PHP indexed arrays use zero-based positions, so index `1` reads the second value.