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!
Now what I want do is add more buttons, links and texts to this list while maintaining the key. I know I can add to an array using array_push() but that doesn't let me add by key.
cpetercarter, thanks for the reply but that's not quite what I was getting at. I don't have an array of those other items, I'm trying to avoid creating a ton of arrays by hand and then merging them. There's got to be a better solution.
Ah well! Thank you! I had not even thought of that approach. I'll give it a shot tomorrow since it's a bit late tonight but it certainly makes sense looking at it.
JakeJ wrote:
Fatal error: [] operator not supported for strings in C:\wamp\www\wow\testarray.php on line 8
This is because originally you had array of strings, while pytrin suggested array of arrays since you can't have two items with the same key in an array.