3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <url xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <loc>https://www.example.com/ca/en/cat/categories/series/07660/</loc> <lastmod>2018-11-07</lastmod> <changefreq>daily</changefreq> <priority>1.0</priority> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="en-ae" href="https://www.example.com/ae/en/cat/categories/series/07660/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="de-at" href="https://www.example.com/at/de/cat/07660/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="en-au" href="https://www.example.com/au/en/cat/categories/series/07660/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="en-ca" href="https://www.example.com/ca/en/cat/categories/series/07660/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="fr-ca" href="https://www.example.com/ca/fr/cat/categories/series/07660/" /> </url> <url xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <loc>https://www.example.com/ca/en/cat/categories/series/07683/</loc> <lastmod>2018-11-07</lastmod> <changefreq>daily</changefreq> <priority>1.0</priority> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="en-ae" href="https://www.example.com/ae/en/cat/categories/series/07683/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="de-at" href="https://www.example.com/at/de/cat/07683/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="en-au" href="https://www.example.com/au/en/cat/categories/series/07683/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="fr-be" href="https://www.example.com/be/fr/collections/07683/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="nl-be" href="https://www.example.com/be/nl/collecties/07683/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="en-bh" href="https://www.example.com/bh/en/cat/07683/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="en-ca" href="https://www.example.com/ca/en/cat/categories/series/07683/" /> <xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="fr-ca" href="https://www.example.com/ca/fr/cat/categories/sies/07683/" /> </url> </urlset>'; $tags = explode("<", $xml); $loc = "not found"; $frhref = "not found"; foreach ($tags as $tag){ if(strpos($tag, "loc>") === 0){ $loc = substr($tag, 4); } if(strpos($tag, "xhtml:link") === 0){ $at = strpos($tag, "hreflang") + 9; $lang = substr($tag, $at, 7); if($lang == '"fr-ca"'){ $at = strpos($tag, "href=") + 6; $_href = substr($tag, $at); $until = strpos($_href, '"'); $frhref = substr($_href, 0, $until); } } } echo $loc, " \n\r"; echo $frhref;
Output for git.master, git.master_jit, rfc.property-hooks
https://www.example.com/ca/en/cat/categories/series/07683/ https://www.example.com/ca/fr/cat/categories/sies/07683/

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
174.33 ms | 405 KiB | 5 Q