PHP Programs

Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 44: Write a program to replace the spaces of a string with a specific character.


<!DOCTYPE html>  
	<title>PHP Programs</title>
		$str1 = "Refer Tutorials Duniya For all Practical List and Guidelines.";  
		$ch = ' + ';  

		echo "Original string is : ";
		echo $str1;
		$str1= str_replace(' ', $ch, $str1); 
		echo "String after replacing spaces with given character :      ";  
		echo $str1;  

If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.