eddy556 Posted February 15, 2009 Share Posted February 15, 2009 How can I access an an access an associative array by number. For example: $myArray["cat"][0] = "this is at place one"; echo $myArray[0][0]; Quote Link to comment Share on other sites More sharing options...
corbin Posted February 15, 2009 Share Posted February 15, 2009 Why would you want to access an assoc array numerically? Kind of defeats the purpose of an assoc array. As far as I know, there is no way to access it numerically. You could ghetto it up though with something like: $i = 0; foreach($array as $key => $value) { $array[$i++] =& $array[$key]; } That would make numerical indexes that are references to the named ones. Quote Link to comment Share on other sites More sharing options...
eddy556 Posted February 15, 2009 Author Share Posted February 15, 2009 Hmm yea I guess so, thanks very much Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.