I want to remove extra spaces present in my string. I have tried trim
,ltrim
,rtrim
and others but non of them are working and even trie
I Think what we are supposed to do here is we should not look for 1 space we should look for consecutive two spaces and then make it one. So this way it would not replace the space between the text and also remove any other space.
$new_string= str_replace(' ', ' ', $old_string)
for more on Str Replace