I was browsing through the PHP source code the other day when two things struck me. First, I must be weird for being curious enough to look up the source code. Second, I found an inefficiency in a seemingly straightforward function that I would like to discuss here.
In the PHP source code for quote_print.c, the first function is
php_hex2int(), which I will provide here: