while(list($key,$val) = each($con_next)) {
echo " $key $con_next[$key]\n";
}
result is
0 list item 1
1 list item 2
2 list item 3
3 list item 4
but i want result
1 list item 1
2 list item 2
3 list item 3
4 list item 4
Don't forget that your arrays start counting from 0. An easy solution is to increase your counters. Instead of allowing $key to start count from 1, add +1 to it and it counts 0 + 1, 1 + 1,.... That way you get what you want.
while(list($key,$val) = each($con_next)) {
echo ($key + 1) . "$con_next[$key]\n";
}