I think the best sollution is to solve it in the SQL-statement like this:
SELECT REPLACE(code,'A','Apples') AS real_code FROM tablename WHERE code='A';
Problem is offcoourse that you can only retrieve the different code's one by one.
In PHP you could use the ereg_replace function:
echo ereg_replace('A','Apples',$code);
Good luck, i hoppe this will work for you.
grtz,
Joris