03-Apr-2023
.
Admin
Hi Dev,
This tutorial shows you how to string replace space with nbsp in php?. This tutorial will give you simple example of php - how replace all spaces inside html elements with . We will use php remove nbsp from string with code examples. you can understand a concept of how to remove all white spaces from a string in php.
There are example to String Replace Space with nbsp in PHP. in this example, we will use to str_replace() function to String Replace Space with nbsp. so Let's the following example with output.
Example 1:
index.php
<?php
$text_description="nbsp;nbsp; nbsp;Hello world! lorel ipsum";
$text_replace = str_replace('nbsp;', ' ', $text_description);
echo $text_replace;
?>
Output:
Hello world! lorel ipsum
I hope it could help you...
#PHP