Skip to content

All topics  /  PHP

How to String Replace Double Quotes in PHP?

PHP

Nov 25, 2022

Hi Dev, in this article, we will discuss how to to string replace double quotes in php . we can get the string replace double quotes by using str_replace() function. this function will string replace double quotes in php.

There are example to check if string replace double quotes in php. in this example, we will use to str_replace() function to check if how to string replace double quotes in php . so let's the following example with output.

Example 1:


index.php

<?php        
    $qtext = 'The "Best" Site is a Nicesnippets.com';
    echo "
Quoted Text is: $qtext";
    $unqtext = str_replace ('"', '', $qtext);
    echo "
Unquoted Text is: $unqtext";
?>

Output:

Quoted Text is: The "Best" Site is a Nicesnippets.com
Unquoted Text is: The Best Site is a Nicesnippets.com

I hope it could help you...