PHP undefined offset array -
i'm trying use , array print out first 3 letters of months name (i know can date(), i'm learning arrays in php , seemed easiest). every time run code @ bottom receive error code below.
notice: undefined offset: 8 in c:\documents , settings\garry\my documents\dropbox\htdocs\web-apps\locander2\alpha\step2.php on line 17
i issue if type 8 or 9 index part of $montharray[]
.
<?php $montharray = array(01 => "jan", 02 => "feb", 03 => "mar", 04 => "apr", 05 => "may", 06 => "jun", 07 => "jul", 08 => "aug", 09 => "sep", 10 => "oct", 11 => "nov", 12 => "dec" ); echo $montharray[8]; ?>
$montharray = array(1 => "jan", 2 => "feb", 3 => "mar", 4 => "apr", 5 => "may", 6 => "jun", 7 => "jul", 8 => "aug", 9 => "sep", 10 => "oct", 11 => "nov", 12 => "dec" );
remove zero(0
) @ index between 1-9. because 01 or 02 not valid decimal number.
Comments
Post a Comment