How do I remove quotes from a string

0 votes

How to remove all types of quotes (different languages) from $string?

$string = "my text has \"double quotes\" and 'single quotes'";

Any php code for this?
 

Nov 16, 2020 in PHP by kartik
• 37,520 points
19,701 views

1 answer to this question.

0 votes

Hello @kartik,

Try this:

str_replace('"', "", $string);
str_replace("'", "", $string);

Otherwise, go for some regex, this will work for html quotes for example:

preg_replace("/<!--.*?-->/", "", $string);

Hope it helps!!

answered Nov 16, 2020 by Niroj
• 82,880 points

Related Questions In PHP

0 votes
1 answer

How Do I Get the Query Builder to Output Its Raw SQL Query as a String?

Hello @kartik, Use the toSql() method on a QueryBuilder instance. DB::table('users')->toSql() would return: select * ...READ MORE

answered Jul 22, 2020 in PHP by Niroj
• 82,880 points
1,054 views
0 votes
1 answer

How do I restore a dump file from mysqldump?

Hello @kartik, It should be as simple as ...READ MORE

answered Aug 18, 2020 in PHP by Niroj
• 82,880 points
1,126 views
0 votes
1 answer

How can I remove a specific item from an array?

Hello @kartik, Find the index of the array element you ...READ MORE

answered Aug 28, 2020 in PHP by Niroj
• 82,880 points
734 views
0 votes
1 answer

How to remove all special characters from a string?

Hello @kartik, This should do what you're looking ...READ MORE

answered Sep 17, 2020 in PHP by Niroj
• 82,880 points
11,413 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
22,957 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
2,968 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
2,899 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
44,397 views
0 votes
1 answer

How do I get a YouTube video thumbnail from the YouTube API?

Hello @kartik, Each YouTube video has four generated ...READ MORE

answered Jun 16, 2020 in PHP by Niroj
• 82,880 points
5,292 views
0 votes
1 answer

How do I UPDATE from a SELECT in SQL Server?

Hello @kartik, In SQL Server, use MERGE MERGE INTO YourTable ...READ MORE

answered Jul 21, 2020 in PHP by Niroj
• 82,880 points
929 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP