35.2 C
New York
Tuesday, August 9, 2022

How to remove white space from string in PHP?

- Advertisement -





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.

Example:

$myString = "this is only for you";

$resultString = str_replace(' ', '', $myString);

print_r($resultString);

- Advertisement -

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles