@ryan.murray as a solution you can use str_replace() function to remove quotes from any string in PHP:
1 2 3 4 5 6 7 8 |
<?php $str = 'How to "remove quotes" in PHP?'; $str = str_replace('"', "", $str); // Output: How to remove quotes in PHP? echo $str; |
@ryan.murray
There are several ways to remove quotes in PHP, depending on what you are trying to achieve:
1 2 3 |
$string = '"Hello World"'; $withoutQuotes = str_replace('"', '', $string); echo $withoutQuotes; // Output: Hello World |
1 2 3 4 5 |
$array = ['"Hello"', '"World"']; $withoutQuotes = array_map(function ($item) { return str_replace('"', '', $item); }, $array); print_r($withoutQuotes); // Output: Array ( [0] => Hello [1] => World ) |
1 2 3 |
$string = ''Hello World''; $withoutQuotes = eval("return $string;"); echo $withoutQuotes; // Output: Hello World |
Note: It's important to understand the context and purpose of removing quotes, as it may not always be necessary or appropriate to do so.