I have an array like so:
$json = array('error'=>true);
But I'd like to perhaps add more keys and values to this at a later time. My feeble knowledge tried this:
$json .= array('something'=>'else');
Which doesn't work. I found array_push
but it seems this is for just pushing in new values - not keys. How is this achieved so that with 2 separate declarations I end up with the equivalent of:
$json .= array('error'=>true,'something'=>'else');
there are many ways to accomplish this:
$json['keyname'] = 'something
$json[] = 'something'
<- numerical incremented key
array_push($json, 'value')
<- same as above
$json = array_merge($json, $some_other_array)
<- mixes the two arrays together
Just keep in mind that arrays are not strings