PHP,使用preg_replace删除双引号内的字符串?

I have a PHP string of the following format:

$str = 'This is a "sample string"';

I want to remove the double quoted string. Like this:

This is a

What I tried:

$fileread = preg_replace('!/\*.*?\*/!s',' -', $fileread);
$fileread = preg_replace('![ \t]*//.*[ \t]*[
]!', '', $fileread);
$separator = preg_replace('/"[^"]+"/','',$fileread);
$separator = explode(" ",$separator);

Is there an easier way to extract that?

You can simply match a string contained inside a double quotes and replace it with an empty string:

$str = 'This is a "sample string".';

$str = preg_replace('/".*"/', '', $str);

echo $str;
<?php
    $str = 'This is a "sample string".';
    $str = preg_replace('#(").*?(")#', '', $str);
    echo $str;
?>

Use this:-

$fileread = preg_replace('("+[a-z A-Z 0-9 !@#$%^&*()]+")', "", $fileread);