I started studying PHP yesterday, and I'm facing a problem already...
Here's my code:
This works, but keeps on returning this:Code:<html> <head> <title>Test array</title> </head> <body> <?php // Here I define my array $assortiment = array("value1","value2","value3","value4","value5","value6"); // Here I just want to display my array using a while loop echo "Arrays unsorted "; echo "Assortiment: "; $i=0; while($assortiment[$i]){ echo $assortiment[$i] . " "; $i++; } ?> </body> </html>
Line 13 is the 'while'-line...
Arrays unsorted
Assortiment: value1 value2 value3 value4 value5 value6
Notice: Undefined offset: 6 in D:\ministry\testarray.php on line 13
I tried Googling 'undefined offset', but all it returns are webpages facing the similar problem...
Anything I'm doing wrong? I'm running PHP 4.2.3 on Apache (Windows).




Reply With Quote