从字符串中删除特定模式

I have an example string of "welcome to my home page (23) | Ayman". I need to remove (23) from this string. Note, that 23 is used only as example and can have any value in this place.

I tried this code:

$str = preg_replace("\(d)/", " ", $str);

But, it is not working as expected.

Try the code:

$str =  "welcome to my home page (23) | Ayman";
echo preg_replace("/\(\d+\)/", "", $str);

(\(\d+\)) will capture (23) (see it in action).

Try this

$Value =  "welcome to my home page (23) | Ayman";
echo preg_replace("/\(\d+\)/", "", $Value );

Here follow instruction for Pattern changes

/     Denotes the start of the pattern
-     Literal - character
\d+   A digit, 1 or more times