Lets say I have this array:
$array = array(\'a\'=>1,\'z\'=>2,\'d\'=>4);
Later in the script, I want to add the value \'c\'=>3<
you can add it by doing
$array['c']=3;
and if you absolutely want it sorted for printing purposes, you can use php's ksort($array) function
if the keys are not sortable by ksort, then you will have to create your own sort by using php's uasort function. see examples here
http://php.net/manual/en/function.uasort.php