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;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 64
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 64
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 63
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 63
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 63
Branch analysis from position: 63
Branch analysis from position: 21
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
filename:       /in/1laON
function name:  (null)
number of ops:  69
compiled vars:  !0 = $xml, !1 = $tags, !2 = $loc, !3 = $frhref, !4 = $tag, !5 = $at, !6 = $lang, !7 = $_href, !8 = $until
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Curlset+xmlns%3D%22http%3A%2F%2Fwww.sitemaps.org%2Fschemas%2Fsitemap%2F0.9%22+xmlns%3Aimage%3D%22http%3A%2F%2Fwww.google.com%2Fschemas%2Fsitemap-image%2F1.1%22+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%3E%0A%3Curl+xmlns%3D%22http%3A%2F%2Fwww.sitemaps.org%2Fschemas%2Fsitemap%2F0.9%22%3E%0A++%3Cloc%3Ehttps%3A%2F%2Fwww.example.com%2Fca%2Fen%2Fcat%2Fcategories%2Fseries%2F07660%2F%3C%2Floc%3E%0A++%3Clastmod%3E2018-11-07%3C%2Flastmod%3E%0A++%3Cchangefreq%3Edaily%3C%2Fchangefreq%3E%0A++%3Cpriority%3E1.0%3C%2Fpriority%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22en-ae%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fae%2Fen%2Fcat%2Fcategories%2Fseries%2F07660%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22de-at%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fat%2Fde%2Fcat%2F07660%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22en-au%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fau%2Fen%2Fcat%2Fcategories%2Fseries%2F07660%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22en-ca%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fca%2Fen%2Fcat%2Fcategories%2Fseries%2F07660%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22fr-ca%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fca%2Ffr%2Fcat%2Fcategories%2Fseries%2F07660%2F%22+%2F%3E%0A%3C%2Furl%3E%0A%3Curl+xmlns%3D%22http%3A%2F%2Fwww.sitemaps.org%2Fschemas%2Fsitemap%2F0.9%22%3E%0A++%3Cloc%3Ehttps%3A%2F%2Fwww.example.com%2Fca%2Fen%2Fcat%2Fcategories%2Fseries%2F07683%2F%3C%2Floc%3E%0A++%3Clastmod%3E2018-11-07%3C%2Flastmod%3E%0A++%3Cchangefreq%3Edaily%3C%2Fchangefreq%3E%0A++%3Cpriority%3E1.0%3C%2Fpriority%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22en-ae%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fae%2Fen%2Fcat%2Fcategories%2Fseries%2F07683%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22de-at%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fat%2Fde%2Fcat%2F07683%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22en-au%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fau%2Fen%2Fcat%2Fcategories%2Fseries%2F07683%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22fr-be%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fbe%2Ffr%2Fcollections%2F07683%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22nl-be%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fbe%2Fnl%2Fcollecties%2F07683%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22en-bh%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fbh%2Fen%2Fcat%2F07683%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22en-ca%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fca%2Fen%2Fcat%2Fcategories%2Fseries%2F07683%2F%22+%2F%3E%0A++%3Cxhtml%3Alink+xmlns%3Axhtml%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+rel%3D%22alternate%22+hreflang%3D%22fr-ca%22+href%3D%22https%3A%2F%2Fwww.example.com%2Fca%2Ffr%2Fcat%2Fcategories%2Fsies%2F07683%2F%22+%2F%3E%0A%3C%2Furl%3E%0A%3C%2Furlset%3E'
   32     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%3C'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !1, $10
   34     6        ASSIGN                                                   !2, 'not+found'
   35     7        ASSIGN                                                   !3, 'not+found'
   36     8      > FE_RESET_R                                       $14     !1, ->64
          9    > > FE_FETCH_R                                               $14, !4, ->64
   37    10    >   INIT_FCALL                                               'strpos'
         11        SEND_VAR                                                 !4
         12        SEND_VAL                                                 'loc%3E'
         13        DO_ICALL                                         $15     
         14        IS_IDENTICAL                                             $15, 0
         15      > JMPZ                                                     ~16, ->21
   38    16    >   INIT_FCALL                                               'substr'
         17        SEND_VAR                                                 !4
         18        SEND_VAL                                                 4
         19        DO_ICALL                                         $17     
         20        ASSIGN                                                   !2, $17
   40    21    >   INIT_FCALL                                               'strpos'
         22        SEND_VAR                                                 !4
         23        SEND_VAL                                                 'xhtml%3Alink'
         24        DO_ICALL                                         $19     
         25        IS_IDENTICAL                                             $19, 0
         26      > JMPZ                                                     ~20, ->63
   41    27    >   INIT_FCALL                                               'strpos'
         28        SEND_VAR                                                 !4
         29        SEND_VAL                                                 'hreflang'
         30        DO_ICALL                                         $21     
         31        ADD                                              ~22     $21, 9
         32        ASSIGN                                                   !5, ~22
   42    33        INIT_FCALL                                               'substr'
         34        SEND_VAR                                                 !4
         35        SEND_VAR                                                 !5
         36        SEND_VAL                                                 7
         37        DO_ICALL                                         $24     
         38        ASSIGN                                                   !6, $24
   43    39        IS_EQUAL                                                 !6, '%22fr-ca%22'
         40      > JMPZ                                                     ~26, ->63
   44    41    >   INIT_FCALL                                               'strpos'
         42        SEND_VAR                                                 !4
         43        SEND_VAL                                                 'href%3D'
         44        DO_ICALL                                         $27     
         45        ADD                                              ~28     $27, 6
         46        ASSIGN                                                   !5, ~28
   45    47        INIT_FCALL                                               'substr'
         48        SEND_VAR                                                 !4
         49        SEND_VAR                                                 !5
         50        DO_ICALL                                         $30     
         51        ASSIGN                                                   !7, $30
   46    52        INIT_FCALL                                               'strpos'
         53        SEND_VAR                                                 !7
         54        SEND_VAL                                                 '%22'
         55        DO_ICALL                                         $32     
         56        ASSIGN                                                   !8, $32
   47    57        INIT_FCALL                                               'substr'
         58        SEND_VAR                                                 !7
         59        SEND_VAL                                                 0
         60        SEND_VAR                                                 !8
         61        DO_ICALL                                         $34     
         62        ASSIGN                                                   !3, $34
   36    63    > > JMP                                                      ->9
         64    >   FE_FREE                                                  $14
   51    65        ECHO                                                     !2
         66        ECHO                                                     '+%0A%0D'
   52    67        ECHO                                                     !3
   53    68      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.99 ms | 1016 KiB | 16 Q