Hi all,
I'm trying to simplify some string management code. Instead of going through various fields from the form (but not each and all of them) that I'd like to first lowercase all, then upper case words one by one, I was trying to accomplish this by using an array, but I'm not able to get the var to take the new value.
//have now, but would like to simplify:
$var1 = ucwords(strtolower($var1));
...
$var12 = ucwords(strtolower($var12));
$ucWordsArray = array ($var1,$var2,$var3,...,$var12);
$counter = 0;
foreach ($ucWordsArray as $uWA) {
$uWA = ucwords(strtolower($uWA));
$counter++;
$ucWordsArray[$counter] = $uWA;
}
//echo of $var1 (for ex) yields the same from the form. not changed.
How can I reassign the newly formated string back into the respective variable?
Thanks!