After surviving 35 years, dozens of languages, hundreds of projects, thousands of meetings and millions of LOC, I now teach the basics to the computer-phobic

Since the first caveman first discovered the concept of this is more valuable than that, the science of alchemy has captured the imagination of many an enterprising soul. Unfortunately, to date, nobody has had any real success in transforming worthless metal into gold. That was, until the wonder that is PHP came along...

Generally, Brad M, doesn't care who wrote what bad code as long as it gets fixed. This little PHP snippet however, made him look up the responsible programmer on Linked In:

/** * This will change the class type of the incoming object to be of * the type of newClassName that is passed in. You must make sure * that the classes of the object that you are changing to and from * have been included prior to calling this function. This class doesn't * have a return type as it changes the object passed in by reference. * * @param object $object * @param object $newClassName */ public static function changeClass ( & $object , $newClassName ) { if ( class_exists ( $newClassName , false ) ) { $object = unserialize ( preg_replace ( " /^O:[0-9]+: \" [^ \" ]+ \" :/i " , " O: " . strlen ( $newClassName ) . " : \" " . $newClassName . " \" : " , serialize ( $object ) ) ) ; } }