Let's say I have a string.
`$str = " Hi, my name is
Petr"; `
Expecting: $str = " Hi, my name is Petr";
I need to replace all the white spaces '....' at the beginning of the string and then if there is a multiple number of white space between words in the string then replace it with one empty space.
I want to do this with the regex function 'preg_replace'.
But I don't know how to "/^\s+/"
for remove white spaces on the start of string and "/\s+/"
for white spaces between words in a string.
Is it possible to merge the two formula patterns into one pattern? If so, what would the formula look like?