I’ve got a string in PHP, MY_NEW_CLASS and I want to convert it to My_New_Class.
Is this possible using preg_replace or should I explode the string on the underscore, strtolower it, ucfirst it, then implode it back together?
I appreciate any help you can offer.
preg_replaceby itself can’t really do it I’d think, but it’s not hard with a callback: