reduce_multiples($str[, $character = ''[, $trim = FALSE]])
Parameters: |
|
---|---|
Returns: |
Reduced string |
Return type: |
string |
Reduces multiple instances of a particular character occuring directly after each other. Example:
$string = "Fred, Bill,, Joe, Jimmy"; $string = reduce_multiples($string,","); //results in "Fred, Bill, Joe, Jimmy"
If the third parameter is set to TRUE it will remove occurrences of the character at the beginning and the end of the string. Example:
$string = ",Fred, Bill,, Joe, Jimmy,"; $string = reduce_multiples($string, ", ", TRUE); //results in "Fred, Bill, Joe, Jimmy"
Please login to continue.