Perform a regular expression search and replace.
Syntax
preg_replace(string $pattern, string $replacement, string $subject): string|nullExample
Enter values below to update the example in real time.
str→echo→preg_replace→Hello→World→$str = "Hello World";
echo preg_replace('/s+/', ' ', $str); // Hello World