I have some data that I'm looping through and I'm using the below line to transform all caps into mixed caps appropriately:
$str = ucwords(strtolower(trim($str)));
Which is great except that it doesn't work so great within parentheses. So I'm trying to run the below line afterwards to fix that problem, but it's not having any impact. I'm seeing zero change.
$str = preg_replace('/\((.+)\)/e', "ucwords('$0')", $str);
It should turn:
Some Product (with Caps In Paren)
Into:
Some Product (With Caps In Paren)