How can PHP developers ensure that array indexes start at 1 instead of 0?
In PHP, array indexes always start at 0 by default. To ensure that array indexes start at 1 instead of 0, developers can manually set the initial index of the array to 1 and then increment it accordingly when adding elements to the array.
<?php
$array = [];
$index = 1;
$array[$index] = "Element 1";
$index++;
$array[$index] = "Element 2";
$index++;
print_r($array);
?>