first, cap97, I was unable to use the mysql custom function because of my host and the number of other sites it hosts, but if you can use it, it's better than the php solution. Here's the compile string I used:
cc -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="/local/mysql" -DDATADIR="/local/mysql/var" -DSHAREDIR="/local/mysql/share/mysql" -DHAVE_CONFIG_H -DUSE_ALARM_THREAD -O3 -DDBUG_OFF -I/usr/include/mysql -shared -o unprefix.so unprefix.c
As for why my method is better:
Concider a large web site using mysql with 12 pages that each need to sort while ignoring the prefix. If you decide to add or remove a prefix, you will need to edit every page to implement that. With my php way you only need to edit one array. Using the mysql function you would need to edit the .c and recompile it.
Also, concider the speed differences between mysql doing nested replaces vs php thumping through an array. PHP will do it faster by a landslide. Also, you don't need to have the database do any sorting at all in your queries (saving some time) if using the php stuff since the php functions will change the sorting anyway.
The ideal solution for this problem is the mysql custom function. I only wrote the php stuff because my host didn't want to implement it. My code was written using the .c mysql function as a template. Of course, the implementation in php was much different.
Were you to do the same thing in postgresql, a custom function there would probably also be the best solution, but my custom function writing in postgresql is limited to more simple functions than what is required in this case, so I can't comment authoritativly on this.