Jump to content

Trim White spaces


web2000

Recommended Posts

Hello,

 

I want to trim all white spaces our of a string and also any other characters other than numbers and letters.

 

It is for a domain name script so it needs everything removed other than numbers and letters

 

I have this so far but this only does white space??

 

$text = preg_replace('/\s+/', ' ', $text);

Link to comment
https://forums.phpfreaks.com/topic/51764-trim-white-spaces/
Share on other sites

Archived

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

×
×
  • Create New...

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.