xProteuSx Posted April 17, 2009 Share Posted April 17, 2009 Is there a function that will remove ALL spaces from a string? I am familiar with chop(), ltrip(), and trim(), but those functions only remove spaces from the front and back of a string ... Quote Link to comment https://forums.phpfreaks.com/topic/154444-solved-remove-all-spaces-from-a-string/ Share on other sites More sharing options...
Philip Posted April 17, 2009 Share Posted April 17, 2009 $text = 'I have spaces'; $output = str_replace(' ','', $text); echo $output; // shows 'Ihavespaces' Quote Link to comment https://forums.phpfreaks.com/topic/154444-solved-remove-all-spaces-from-a-string/#findComment-812060 Share on other sites More sharing options...
xProteuSx Posted April 17, 2009 Author Share Posted April 17, 2009 Thanks a million! Quote Link to comment https://forums.phpfreaks.com/topic/154444-solved-remove-all-spaces-from-a-string/#findComment-812061 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.