I am new to PHP arrays and trying to think about how to create a multidimensional associative array. I would like the array to look like this when I use print_r:
Array ( [0] => Array ( [alert] => alert [email] => Test ) )
Instead, I get the following:
Array ( [0] => Array ( [alert] => Array ( [email] => Test ) ) )
The code I use is as follows:
$alert_array = array(); $alert_array[]["alert"]["email"] = "Test";
I thought trying something like this would work, but obviously my syntax is a bit off. I think I'm a little right, but ?:
$alert_array[][["alert"]["email"]] = "Test";
Thank you for your help (sorry if this is super basic, I could not find any questions that related to this)!
source share