php - How to replace an url with the value of a parameter inside that URL?
Get the solution ↓↓↓Solution:
You could use sprintf to build your string instead.
Answer
Solution:
How about:
$output = 'http://professional.player.qbrick.com/player.aspx?mid=asdas23234ASD';
$output = preg_replace(
"#(http://.*?\?mid=[0-9a-zA-Z]+)\b#ismU",
"<iframe src=\"$1\"></iframe>",
$output
);
echo $output,"\n";
output:
<iframe src="http://professional.player.qbrick.com/player.aspx?mid=asdas23234ASD"></iframe>
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: using $this when not in object context laravel
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.