Just an idea...
...it may send you on the right track.
Separate every value in the array.
(i'm not sure how you would do this, but this is how I envisage it):
$rowfield['compname'];
$rowfield['compcode'];
etc....
Then perform a series of PHP string functions on each variable:
Maybe using
$rowfield['compname'] = substr_replace($rowfield['compname'], 'pany ', 3, -4);
This (I think) would count 3 characters into the variable (com) and 4 characters in from the right (name) and replace with "pany " (*note the space after 'y').
Do this for compcode (3, -4) and compindustry (3, -8).
They should equal = company name / company code / company industry.
Then maybe use:
ucwords($rowfield['compname']);
Which converts the first letter of every word in a string to uppercase:
Company Name.
Just a thought.
I don't understand enough about pulling arrays and whether they even work in string functions but give it a try.
I would like to see your attempts.
Good luck