I was looking for some standard PHP function to replace some value of an array with other, but surprisingly I haven\'t found any, so I have to write my own:
$ar[array_search('green', $ar)] = 'value';