How to Remove White Space from String in PHP?
If you need to see an example of how to remove space from string in php. you will learn how to remove all whitespace from a string in php. you can understand a concept of remove whitespace from string php. This article goes in detailed on remove space from string in php. Here, Create a basic example of delete space from string in php.
Sometimes we require to remove white space from given string. So at that time you can delete spaces from string using str_replace() of core php. str_replace() will help to replace whitespace that way we can remove. you can do it from bellow example.
/* Declare string variable */
$myString = "Welcome to ItSolutionStuff.com!";
/* remove white space from string in PHP */
$newString = str_replace(' ', '', $myString);
/* Echo resulted string */
I hope it can help you...
We are Recommending you
- How to Get First and Last Character from String in PHP?
- How to Get Last Character from String in PHP?
- How to Get First Character from String in PHP?
- How to Remove Last Character from String in PHP?
- How to Remove First Character from String in PHP?
- PHP Remove First and Last Character from String Example
- PHP Remove Whitespace from Beginning and End of String Example
- How to Check Query Execution Time in PHP?
- PHP curl post request with parameters and get json response
- PHP - Jquery Chosen Ajax Autocomplete Example
- How to get folder path from file path in PHP?
- How to access PHP variables in JQuery?