Category "preg-replace"

Clean up a comma-separated list by regex

I want to clean up a tag list separated by comma to remove empty tags and extra spaces. I came up with $str='first , second ,, third, ,fourth suffix'; echo pr

Remove country code from phone number?

Below is the code I am currently using to format phone numbers for databasing. However iOS is putting a +1 or 1 (country code) before it in autofills. How can I

str_replace or preg_replace random number from string

I have a url from where i am fetching value using GET method and i want to replace that value with the 4 digit random number in the string like This is my main