I would say something like "Of course, this entire exercise is just for fun and in practice is totally useless," but whenever I start out thinking that something actually productive eventually emerges. So perhaps this is totally useless, perhaps not!
I tried to benchmark
at one point and came to the conclusion that from a string length of 35-40 (and assuming $a and $b have about the same length that , starts to get faster.
Not that I've ever seen an application that remotely would benefit from a fast echo/output
I think Russ's preg_replace() contraption has a certain amount of "ridiculous, but not too ridiculous" elegance, but the combination of using MySQL's CONCAT() function and then extract() in demiurg's I think takes the "hilarious overkill" prize!