Replace Double Quotes With Single Quotes PHP

In this tutorial we will see How To Replace Double Quotes With Single Quotes in PHP. PHP str_replace() Function can be used to replace the Double Quotes With Single Quotes in PHP.

PHP str_replace() Function

PHP str_replace() Function replaces given characters or a string with other string or characters.

In this example str_replace() function is used to replace the Double Quotes with Single Quotes.

<?php
$string = '"HowToCodeSchool"';
$string = str_replace('"', "'", $string);
echo $string;
?>

In above code of PHP, Double Quotes is replaced with Single Quotes.

More PHP Replace Tutorial:

Replace Space With Underscore in PHP
Replace Space With Dash in PHP
Replace Space With &nbsp; in PHP
Replace Dash With Space in PHP
Replace Underscore With Space in PHP
Replace Single Quotes With Double Quotes in PHP