Skip to content
Advertisement

php: Add value to exsiting key in array

I have an array:

JavaScript

I want to add one or more value to the “email”. What I want to achieve is:

JavaScript

Is there a way to push it?

Advertisement

Answer

You can do this, but you should be clear that it’s what you want to do. If you change the datatype of any part of your program there could be unexpected knock on effects (e.g. does your program check if $my_array['email'] is a string or an array)

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement