How do I remove all spaces out of a string in php ? November 23, 2021 by Codingtube team To remove all spaces out of a string we ll use str_replace function of php Here is the top answer to remove all spaces out of string in php