Problem:- How to Start an Array with Index 1 in PHP? You want to assign multiple elements to an array in one steps but you don’t want the first index to be 0;
Solution – Start an Array with Index 1 in PHP?
<?php $color =array(1=>'red', 'green', 'blue'); print_r($color); ?>
How it Works?
Super Easy, If we define a index number while initializing an array next index number change according the previous number.