Skip to content
Advertisement

Get all values inside quotes in php string

I have the following string:

JavaScript

I want to display only the text inside the double quotes, in this case the urls. I’m using the following code:

JavaScript

This code extracts the urls from the string but is adding single quotes and I need the plain url without single or double quotes:

‘https://thisurl.com’ ‘https://thatsurl.com’

Any ideas how to fix this?

Advertisement

Answer

Why reinvent the wheel?

Use PHP’s SimpleXML parser to do the job;

JavaScript

Output:

JavaScript

Based on comment (same output);

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement