Lütfen ayki sayı değişken içinde saklanır ise, sizin dizideki doğru öğeye erişmek için kullanabilirsiniz. Gibi strong> $array[index] gibi bir sözdizimi kullanarak.
For example, the following portion of code :
$month_options = array("Month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$month_num = 3;
echo $month_options[$month_num];
size vermek istiyorum:
March
Unutmayınız ki, PHP, array indexes start at 0 - indeksi ile madde 3 dizide aslında dördüncü madde olduğu anlamına gelir.
Here, though, the first item in the array is not quite useful : it's a month -- so, you could remove it -- and you'd have to add 1 to the index used to point to the right month :
$month_options = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$month_num = 3;
echo $month_options[$month_num + 1];
And you might to go through the array section of the PHP manual ;-)