array indexing -1 works but +1 doesnt

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gth759k
Forum Commoner
Posts: 76
Joined: Mon Jun 15, 2009 3:04 am

array indexing -1 works but +1 doesnt

Post by gth759k »

This is driving me nuts!

I have an array of photo ids and if I echo $thisphoto[$i-1]; it spits out the correct photo id; I have other code that handles that, but when I echo $thisphoto[$i+1]; it spits out nothing at all. So I tried echo $thisphoto[0]; and no surprise, it spit our the right number, but then I tried echo $thisphoto[1]; and nothing. echo count($thisphoto); spits out 7 so I don't see what the problem is. Any help would be appreciated. Thanks.
gth759k
Forum Commoner
Posts: 76
Joined: Mon Jun 15, 2009 3:04 am

Re: array indexing -1 works but +1 doesnt

Post by gth759k »

Never mind, I figured it out. My bad.
Post Reply