I have been trying to code this for a while but I am so confused with multidimensional arrays.
I have simplified it to this:
Consider I already have an array:
$myarray = ("1233","4345","3452");
I would like to push an array, onto this array (to create multidimensional array) at a certain value.
For example,
With these two variables:
$eventID = 4345
$photoID = 12
I would want to end up with:
("1233", "4345 => 12", "3452")
First, your array needs to be an “associative array”. You can create the array in one statement like this:
Or one item at a time like this:
This is still one dimensional array. You can go one step further and create a multi-dimensional array like this:
See the section on Arrays in PHP manual. It is a very frequently used data structure in PHP and I encourage you to read the section thoroughly.