I want to append an element to to end of an associative array.
For example, my array is
$test=Array ([chemical] => asdasd [chemical_hazards] =>
You can do this with PHP's array_merge function.
$test = array('chemical' => 'asdasd', 'chemical_hazards' => 'ggggg');
$test2 = array('solution' => 'good');
$result = array_merge($test, $test2);
var_dump($result);
Just add it like you would with a non-associative array:
$test = array('chemical' => 'asdasd', 'chemical_hazards' => 'ggggg'); //init
$test['solution'] = 'good';