Jump to content

Archived

This topic is now archived and is closed to further replies.

gerkintrigg

Removing numbers from a string

Recommended Posts

Hiya, could anyone tell me the best way to remove numbers from a text string please? I think it's using explode, but i don't remember the correct syntax and can't seem to find an example anywhere.

The string is coming from a database (dunno if this makes a difference).

thanks.

Share this post


Link to post
Share on other sites
$string = "abc123abc";
$new_str = preg_replace("/[0-9]+/i","",$string);
echo $new_str;

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.