Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How come the code <?php print "contents: $arr[1]"; ?> Works, but <?php print "contents: $arr[1][2]"; ?> Doesn't for two-dimensional array of mine?

Answer Posted / Nimmi Gupta

The reason is that you are trying to access a nested element in your array. In PHP, arrays are zero-indexed, so if you have a two-dimensional array and you want to access the second row and third column, you should use $arr[1][2], not $arr[1][3]. The 0-based indexing causes an error when you try to access elements outside of the defined range.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How much is the wordpress business plan?

161


Tell me how do I redirect users back to my blog's main page after they login?

204


Do you know what is the current version of wordpress?

196