Jump to content

Archived

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

kevinkorb

Remove all non-alphabetical characters

Recommended Posts

$string = 'the rapist 4';

I want to remove all non-alpha characters to produce

$new_string = 'therapist';

Thanks a bunch... I'm sure this is cake for most of you. 

Share this post


Link to post
Share on other sites
[code]
<?php
$string = 'the rapist 4';
$string = preg_replace('/[^a-zA-Z]/', '', $string);
echo $string;
?>
[/code]

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.