$str = '<iframe src="https://www.google.com/maps/place/the-big-junky-map-url-with-lat-lon-etc-etc" width="100%" height="350" frameborder="0" style="border:0;" allowfullscreen></iframe>';
$matches = array();
preg_match('/src\=\"((.*?))\"/i',$map, $matches);
echo '<pre>';print_r($matches);die();
Ich möchte die URL aus src
Attribut extrahieren. Und ich bekomme folgende in .preg_match - Warum zwei identische Elemente in Übereinstimmungen
Array
(
[0] => src="https://www.google.com/maps/place/the-big-junky-map-url-with-lat-lon-etc-etc"
[1] => https://www.google.com/maps/place/the-big-junky-map-url-with-lat-lon-etc-etc
[2] => https://www.google.com/maps/place/the-big-junky-map-url-with-lat-lon-etc-etc
)
Ich habe, was ich brauchte, aber warum gibt es zwei identische Artikel bei [1] und [2]? Wie kann ich das vermeiden?
'((. *?))' 2x einfangenden Gruppen == 2x Ergebniselemente – Rizier123
Sie sollten verwenden '$ str' '$ Karte'. –
@ Rizier123, Sie haben Recht –