Further reading
There is a UDF repository run by Roland Bouman that contains various useful functions in both source and binary forms. This can be found at http://www.mysqludf.org/.
To make the UDF API even easier to use, Hartmut Holzgraefe, a MySQL Support Manager at Sun Microsystems, has created a UDF generator. This generates the source code for you based on an XML description of what the UDF should do. More information on this can be found at its PECL site at: http://pear.php.net/package/CodeGen_MySQL_UDF/