How to String Replace Hash With Space in PHP?

03-Apr-2023

.

Admin

How to String Replace Hash With Space in PHP?

Hi Dev,

In this example, you will learn how to string replace hash with space in PHP. This tutorial will give you simple example of all the space in a string with hash in PHP. I explained simply about replace hash (#) with space using PHP. step by step explain PHP string replace hash code example. follow bellow step for PHP str_replace function example.

str_replace() function is used to replace the hash with space.

Example: 1


index.php

<?php

$string = "Learn#PHP#post#at#nicesnippets.com";

$string = str_replace('#', ' ', $string);

echo $string;

?>

Output:

Learn PHP post at nicesnippets.com

I hope it could help you...

#PHP