As for your original question, your problem is within the definition of the for() loop:
for($i=0;$i<=count($Array);$i++) {
Note here that you're going from 0 up to the length of the array, inclusively. So for an array of 3 items (numbered 0-2), you're looping from 0 to 3 - obviously, the 4th index (numerically, 3) is extraneous. Change the '<=' to just '<' and it will work as expected.
Also, if you had error_reporting set to E_ALL (a must for a development server, IMHO), you should get PHP warnings about accessing an invalid array index on the last iteration of that for() loop.