3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = <<<HTML <div class="article" id="titleDetails"> <span class="rightcornerlink"> </span> <div class="txt-block"> <h4 class="inline">Country:</h4> <a href="/country/us?ref_=tt_dt_dt" itemprop="url">USA</a> </div> <div class="txt-block"> <h4 class="inline">Language:</h4> <a href="/language/en?ref_=tt_dt_dt" itemprop="url">English</a> </div> </div> HTML; $html = HtmlParser::from_string($str); var_dump(HtmlParser::css_to_xpath('#titleDetails h4')); foreach ($html->find('#titleDetails h4') as $r) { if (preg_match('/Country/', $r->text)) { var_dump($r->text); var_dump($r->parent()->find('a', 0)->text); } } /** * Author: Hitesh Kumar, IIT Delhi. * License: http://en.wikipedia.org/wiki/WTFPL */ class HtmlParser { public static function from_string($str, $xml = false) { libxml_use_internal_errors(true); $html = new DOMDocument(); if($xml) { $html->loadXML($str); } else { $html->preserveWhiteSpace = true; $html->loadHTML($str); } libxml_clear_errors(); $dom_xpath = new DOMXPath($html); return new HtmlNode($html->documentElement, $dom_xpath); } public static function from_file($file, $xml = false) { $str = file_get_contents($file); return self::from_string($str, $xml); } // Converts a given CSS Selector expression to xpath expression. // This function is direct port of firebug's css to xpath convertor. public static function css_to_xpath($rule) { $reg_element = '/^([#.]?)([a-z0-9\\*_-]*)((\|)([a-z0-9\\*_-]*))?/i'; $reg_attr1 = '/^\[([^\]]*)\]/i'; $reg_attr2 = '/^\[\s*([^~=\s]+)\s*(~?=)\s*"([^"]+)"\s*\]/i'; $reg_attr3 = '/^\[\s*([^~=\s]+)\s*(~?=)\s*\'([^\']+)\'\s*\]/i'; $reg_attr4 = '/^\[\s*([^~=\s]+)\s*(~?=)\s*([^\]]+)\s*\]/i'; $reg_pseudo = '/^:([a-z_-]+)(\([a-z_-]+\))?/i'; $reg_combinator = '/^(\s*[>+\s])?/i'; $reg_comma = '/^\s*,/i'; $index = 1; $parts = array(".//", "*"); $last_rule = null; while ($rule && $rule !== $last_rule) { $last_rule = $rule; // Trim leading whitespace $rule = trim($rule); if (!$rule) break; // Match the element identifier preg_match($reg_element, $rule, $m); if ($m) { if (!$m[1]) { // XXXjoe Namespace ignored for now if (isset($m[5])) $parts[$index] = $m[5]; else $parts[$index] = $m[2]; } else if ($m[1] == '#') $parts[] = "[@id='" . $m[2] . "']"; else if ($m[1] == '.') $parts[] = "[contains(concat(' ',@class,' '), ' " . $m[2] . " ')]"; $rule = substr($rule, strlen($m[0])); } // Match attribute selectors preg_match($reg_attr4, $rule, $m); if(!$m) preg_match($reg_attr3, $rule, $m); if(!$m) preg_match($reg_attr2, $rule, $m); if ($m) { if ($m[2] == "~=") $parts[] = "[contains(concat(' ', @" . $m[1] . ", ' '), ' " . $m[3] . " ')]"; else $parts[] = "[@" . $m[1] . "='" . $m[3] . "']"; $rule = substr($rule, strlen($m[0])); } else { preg_match($reg_attr1, $rule, $m); if ($m) { $parts[] = "[@" . $m[1] . "]"; $rule = substr($rule, strlen($m[0])); } } // Skip over pseudo-classes and pseudo-elements, which are of no use to us preg_match($reg_pseudo, $rule, $m); while ($m) { // Handle Later // if($m[1] && $m[2]) // { // $m[2] = substr($m[2], 1, -1); // switch($m[1]) // { // case 'contains': // $parts[] = '[contains(translate(normalize-space(string(.)),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz"),translate("'.$m[2].'","ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz"))]'; // } // } $rule = substr($rule, strlen($m[0])); preg_match($reg_pseudo, $rule, $m); } // Match combinators preg_match($reg_combinator, $rule, $m); if ($m && strlen($m[0])) { if (strpos($m[0], ">") !== false) $parts[] = "/"; else if (strpos($m[0], "+") !== false) $parts[] = "/following-sibling::"; else $parts[] = "//"; $index = count($parts); $parts[] = "*"; $rule = substr($rule, strlen($m[0])); } preg_match($reg_comma, $rule, $m); if ($m) { $parts[] = " | "; $parts[] = ".//"; $index = count($parts); $parts[] = "*"; $rule = substr($rule, strlen($m[0])); } } $xpath = implode("", $parts); return $xpath; } } class HtmlNode { private $dom_xpath; private $node; public function __construct($node, $dom_xpath = null) { $this->node = $node; if($dom_xpath) $this->dom_xpath = $dom_xpath; } // use $node->text for node's text. // use $node->html for node's inner HTML. // use $node->anything for node's attribute. public function __get($name) { if($name == 'text' || $name == 'plaintext') return $this->text(); else if($name == 'html') return $this->html(); else if($this->node->hasAttribute($name)) return $this->node->getAttribute($name); else return null; } // finds nodes by css selector expression. // returns an array of nodes if $idx is not given, otherwise returns a single node at index $idx. // returns null if node not found or error in selector expression. // $idx can be negative (find from last). public function find($query, $idx = null) { $xpath = HtmlParser::css_to_xpath($query); return $this->xpath($xpath, $idx); } // finds nodes by xpath expression. public function xpath($xpath, $idx = null) { $result = $this->dom_xpath->query($xpath, $this->node); if($idx === null) { if(!$result) return array(); return self::wrap_nodes($result, $this->dom_xpath); } else if($idx >= 0) { if(!$result) return null; return self::wrap_node($result->item($idx), $this->dom_xpath); } else { if(!$result) return null; return self::wrap_node($result->item($result->length + $idx), $this->dom_xpath); } } public function child($idx = null) { if(!$this->node->hasChildNodes()) return array(); $nodes = array(); foreach($this->node->childNodes as $node) { if($node->nodeType === XML_ELEMENT_NODE) $nodes[] = $node; } if($idx === null) { if(!$nodes) return array(); return self::wrap_nodes($nodes, $this->dom_xpath); } else if($idx >= 0) { if(!$nodes) return null; return self::wrap_node($nodes[$idx], $this->dom_xpath); } else { if(!$nodes) return null; return self::wrap_node($nodes[count($nodes) + $idx], $this->dom_xpath); } } public function has_child() { if($this->node->hasChildNodes()) { foreach($this->node->childNodes as $node) { if($node->nodeType === XML_ELEMENT_NODE) return true; } } return false; } public function first_child() { $node = $this->node->firstChild; while($node && $node->nodeType !== XML_ELEMENT_NODE) { $node = $node->nextSibling; } return self::wrap_node($node, $this->dom_xpath); } public function last_child() { $node = $this->node->lastChild; while($node && $node->nodeType !== XML_ELEMENT_NODE) { $node = $node->previousSibling; } return self::wrap_node($node, $this->dom_xpath); } public function parent() { $node = $this->node->parentNode; while($node && $node->nodeType !== XML_ELEMENT_NODE) { $node = $node->parentNode; } return self::wrap_node($node, $this->dom_xpath); } public function next() { $node = $this->node->nextSibling; while($node && $node->nodeType !== XML_ELEMENT_NODE) { $node = $node->nextSibling; } return self::wrap_node($node, $this->dom_xpath); } public function prev() { $node = $this->node->previousSibling; while($node && $node->nodeType !== XML_ELEMENT_NODE) { $node = $node->previousSibling; } return self::wrap_node($node, $this->dom_xpath); } public function text() { return $this->node->nodeValue; } public function html() { $tag = $this->node_name(); return preg_replace('@(^<' . $tag . '[^>]*>)|(</' . $tag . '>$)@', '', $this->outer_html()); } public function inner_html() { return $this->html(); } public function outer_html() { $doc = new DOMDocument(); $doc->appendChild($doc->importNode($this->node, TRUE)); $html = trim($doc->saveHTML()); return $html; } public function node_name() { return $this->node->nodeName; } // Wrap given DOMNodes in HtmlNode and return an array of them. private static function wrap_nodes($nodes, $dom_xpath = null) { $wrapped = array(); foreach($nodes as $node) { $wrapped[] = new HtmlNode($node, $dom_xpath); } return $wrapped; } // Wrap a given DOMNode in HtmlNode. private static function wrap_node($node, $dom_xpath = null) { if($node == null) return null; return new HtmlNode($node, $dom_xpath); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 37
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 37
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 36
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 36
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/OS87W
function name:  (null)
number of ops:  39
compiled vars:  !0 = $str, !1 = $html, !2 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv+class%3D%22article%22+id%3D%22titleDetails%22%3E%0A++++%3Cspan+class%3D%22rightcornerlink%22%3E%0A++++%3C%2Fspan%3E%0A%0A++++%3Cdiv+class%3D%22txt-block%22%3E%0A++++%3Ch4+class%3D%22inline%22%3ECountry%3A%3C%2Fh4%3E%0A++++%3Ca+href%3D%22%2Fcountry%2Fus%3Fref_%3Dtt_dt_dt%22+itemprop%3D%22url%22%3EUSA%3C%2Fa%3E%0A++++%3C%2Fdiv%3E%0A%0A++++%3Cdiv+class%3D%22txt-block%22%3E%0A++++%3Ch4+class%3D%22inline%22%3ELanguage%3A%3C%2Fh4%3E%0A++++%3Ca+href%3D%22%2Flanguage%2Fen%3Fref_%3Dtt_dt_dt%22+itemprop%3D%22url%22%3EEnglish%3C%2Fa%3E%0A++++%3C%2Fdiv%3E%0A%3C%2Fdiv%3E'
   20     1        INIT_STATIC_METHOD_CALL                                  'HtmlParser', 'from_string'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !1, $4
   22     5        INIT_FCALL                                               'var_dump'
          6        INIT_STATIC_METHOD_CALL                                  'HtmlParser', 'css_to_xpath'
          7        SEND_VAL_EX                                              '%23titleDetails+h4'
          8        DO_FCALL                                      0  $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                                 
   23    11        INIT_METHOD_CALL                                         !1, 'find'
         12        SEND_VAL_EX                                              '%23titleDetails+h4'
         13        DO_FCALL                                      0  $8      
         14      > FE_RESET_R                                       $9      $8, ->37
         15    > > FE_FETCH_R                                               $9, !2, ->37
   25    16    >   INIT_FCALL                                               'preg_match'
         17        SEND_VAL                                                 '%2FCountry%2F'
         18        FETCH_OBJ_R                                      ~10     !2, 'text'
         19        SEND_VAL                                                 ~10
         20        DO_ICALL                                         $11     
         21      > JMPZ                                                     $11, ->36
   27    22    >   INIT_FCALL                                               'var_dump'
         23        FETCH_OBJ_R                                      ~12     !2, 'text'
         24        SEND_VAL                                                 ~12
         25        DO_ICALL                                                 
   28    26        INIT_FCALL                                               'var_dump'
         27        INIT_METHOD_CALL                                         !2, 'parent'
         28        DO_FCALL                                      0  $14     
         29        INIT_METHOD_CALL                                         $14, 'find'
         30        SEND_VAL_EX                                              'a'
         31        SEND_VAL_EX                                              0
         32        DO_FCALL                                      0  $15     
         33        FETCH_OBJ_R                                      ~16     $15, 'text'
         34        SEND_VAL                                                 ~16
         35        DO_ICALL                                                 
   23    36    > > JMP                                                      ->15
         37    >   FE_FREE                                                  $9
  389    38      > RETURN                                                   1

Class HtmlParser:
Function from_string:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OS87W
function name:  from_string
number of ops:  32
compiled vars:  !0 = $str, !1 = $xml, !2 = $html, !3 = $dom_xpath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
   42     2        INIT_FCALL                                               'libxml_use_internal_errors'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                                 
   43     5        NEW                                              $5      'DOMDocument'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $5
   45     8      > JMPZ                                                     !1, ->13
   47     9    >   INIT_METHOD_CALL                                         !2, 'loadXML'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0          
         12      > JMP                                                      ->18
   51    13    >   ASSIGN_OBJ                                               !2, 'preserveWhiteSpace'
         14        OP_DATA                                                  <true>
   52    15        INIT_METHOD_CALL                                         !2, 'loadHTML'
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0          
   55    18    >   INIT_FCALL                                               'libxml_clear_errors'
         19        DO_ICALL                                                 
   57    20        NEW                                              $12     'DOMXPath'
         21        SEND_VAR_EX                                              !2
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !3, $12
   58    24        NEW                                              $15     'HtmlNode'
         25        CHECK_FUNC_ARG                                           
         26        FETCH_OBJ_FUNC_ARG                               $16     !2, 'documentElement'
         27        SEND_FUNC_ARG                                            $16
         28        SEND_VAR_EX                                              !3
         29        DO_FCALL                                      0          
         30      > RETURN                                                   $15
   59    31*     > RETURN                                                   null

End of function from_string

Function from_file:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OS87W
function name:  from_file
number of ops:  12
compiled vars:  !0 = $file, !1 = $xml, !2 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
   63     2        INIT_FCALL                                               'file_get_contents'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
   64     6        INIT_STATIC_METHOD_CALL                                  'from_string'
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $5      
         10      > RETURN                                                   $5
   65    11*     > RETURN                                                   null

End of function from_file

Function css_to_xpath:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 213
Branch analysis from position: 213
2 jumps found. (Code = 46) Position 1 = 214, Position 2 = 216
Branch analysis from position: 214
2 jumps found. (Code = 44) Position 1 = 217, Position 2 = 13
Branch analysis from position: 217
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 217
Branch analysis from position: 217
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 64
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 40
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 76
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 83
Branch analysis from position: 78
2 jumps found. (Code = 43) Position 1 = 84, Position 2 = 112
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 87, Position 2 = 96
Branch analysis from position: 87
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
1 jumps found. (Code = 42) Position 1 = 130
Branch analysis from position: 130
1 jumps found. (Code = 42) Position 1 = 148
Branch analysis from position: 148
2 jumps found. (Code = 44) Position 1 = 149, Position 2 = 136
Branch analysis from position: 149
2 jumps found. (Code = 46) Position 1 = 155, Position 2 = 158
Branch analysis from position: 155
2 jumps found. (Code = 43) Position 1 = 159, Position 2 = 192
Branch analysis from position: 159
2 jumps found. (Code = 43) Position 1 = 166, Position 2 = 169
Branch analysis from position: 166
1 jumps found. (Code = 42) Position 1 = 181
Branch analysis from position: 181
2 jumps found. (Code = 43) Position 1 = 198, Position 2 = 213
Branch analysis from position: 198
2 jumps found. (Code = 46) Position 1 = 214, Position 2 = 216
Branch analysis from position: 214
Branch analysis from position: 216
Branch analysis from position: 213
Branch analysis from position: 169
2 jumps found. (Code = 43) Position 1 = 176, Position 2 = 179
Branch analysis from position: 176
1 jumps found. (Code = 42) Position 1 = 181
Branch analysis from position: 181
Branch analysis from position: 179
2 jumps found. (Code = 43) Position 1 = 198, Position 2 = 213
Branch analysis from position: 198
Branch analysis from position: 213
Branch analysis from position: 192
Branch analysis from position: 158
Branch analysis from position: 136
2 jumps found. (Code = 44) Position 1 = 149, Position 2 = 136
Branch analysis from position: 149
Branch analysis from position: 136
Branch analysis from position: 96
1 jumps found. (Code = 42) Position 1 = 130
Branch analysis from position: 130
Branch analysis from position: 112
2 jumps found. (Code = 43) Position 1 = 118, Position 2 = 130
Branch analysis from position: 118
1 jumps found. (Code = 42) Position 1 = 148
Branch analysis from position: 148
Branch analysis from position: 130
Branch analysis from position: 83
Branch analysis from position: 76
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 49
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 57
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 76
Branch analysis from position: 71
Branch analysis from position: 76
Branch analysis from position: 57
Branch analysis from position: 64
Branch analysis from position: 216
filename:       /in/OS87W
function name:  css_to_xpath
number of ops:  224
compiled vars:  !0 = $rule, !1 = $reg_element, !2 = $reg_attr1, !3 = $reg_attr2, !4 = $reg_attr3, !5 = $reg_attr4, !6 = $reg_pseudo, !7 = $reg_combinator, !8 = $reg_comma, !9 = $index, !10 = $parts, !11 = $last_rule, !12 = $m, !13 = $xpath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   RECV                                             !0      
   71     1        ASSIGN                                                   !1, '%2F%5E%28%5B%23.%5D%3F%29%28%5Ba-z0-9%5C%2A_-%5D%2A%29%28%28%5C%7C%29%28%5Ba-z0-9%5C%2A_-%5D%2A%29%29%3F%2Fi'
   72     2        ASSIGN                                                   !2, '%2F%5E%5C%5B%28%5B%5E%5C%5D%5D%2A%29%5C%5D%2Fi'
   73     3        ASSIGN                                                   !3, '%2F%5E%5C%5B%5Cs%2A%28%5B%5E%7E%3D%5Cs%5D%2B%29%5Cs%2A%28%7E%3F%3D%29%5Cs%2A%22%28%5B%5E%22%5D%2B%29%22%5Cs%2A%5C%5D%2Fi'
   74     4        ASSIGN                                                   !4, '%2F%5E%5C%5B%5Cs%2A%28%5B%5E%7E%3D%5Cs%5D%2B%29%5Cs%2A%28%7E%3F%3D%29%5Cs%2A%27%28%5B%5E%27%5D%2B%29%27%5Cs%2A%5C%5D%2Fi'
   75     5        ASSIGN                                                   !5, '%2F%5E%5C%5B%5Cs%2A%28%5B%5E%7E%3D%5Cs%5D%2B%29%5Cs%2A%28%7E%3F%3D%29%5Cs%2A%28%5B%5E%5C%5D%5D%2B%29%5Cs%2A%5C%5D%2Fi'
   76     6        ASSIGN                                                   !6, '%2F%5E%3A%28%5Ba-z_-%5D%2B%29%28%5C%28%5Ba-z_-%5D%2B%5C%29%29%3F%2Fi'
   77     7        ASSIGN                                                   !7, '%2F%5E%28%5Cs%2A%5B%3E%2B%5Cs%5D%29%3F%2Fi'
   78     8        ASSIGN                                                   !8, '%2F%5E%5Cs%2A%2C%2Fi'
   80     9        ASSIGN                                                   !9, 1
   81    10        ASSIGN                                                   !10, <array>
   82    11        ASSIGN                                                   !11, null
   84    12      > JMP                                                      ->213
   86    13    >   ASSIGN                                                   !11, !0
   89    14        INIT_FCALL                                               'trim'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $26     
         17        ASSIGN                                                   !0, $26
   90    18        BOOL_NOT                                         ~28     !0
         19      > JMPZ                                                     ~28, ->21
   91    20    > > JMP                                                      ->217
   94    21    >   INIT_FCALL                                               'preg_match'
         22        SEND_VAR                                                 !1
         23        SEND_VAR                                                 !0
         24        SEND_REF                                                 !12
         25        DO_ICALL                                                 
   95    26      > JMPZ                                                     !12, ->64
   97    27    >   FETCH_DIM_R                                      ~30     !12, 1
         28        BOOL_NOT                                         ~31     ~30
         29      > JMPZ                                                     ~31, ->40
  100    30    >   ISSET_ISEMPTY_DIM_OBJ                         0          !12, 5
         31      > JMPZ                                                     ~32, ->36
  101    32    >   FETCH_DIM_R                                      ~34     !12, 5
         33        ASSIGN_DIM                                               !10, !9
         34        OP_DATA                                                  ~34
         35      > JMP                                                      ->39
  103    36    >   FETCH_DIM_R                                      ~36     !12, 2
         37        ASSIGN_DIM                                               !10, !9
         38        OP_DATA                                                  ~36
         39    > > JMP                                                      ->57
  105    40    >   FETCH_DIM_R                                      ~37     !12, 1
         41        IS_EQUAL                                                 ~37, '%23'
         42      > JMPZ                                                     ~38, ->49
  106    43    >   FETCH_DIM_R                                      ~40     !12, 2
         44        CONCAT                                           ~41     '%5B%40id%3D%27', ~40
         45        CONCAT                                           ~42     ~41, '%27%5D'
         46        ASSIGN_DIM                                               !10
         47        OP_DATA                                                  ~42
         48      > JMP                                                      ->57
  107    49    >   FETCH_DIM_R                                      ~43     !12, 1
         50        IS_EQUAL                                                 ~43, '.'
         51      > JMPZ                                                     ~44, ->57
  108    52    >   FETCH_DIM_R                                      ~46     !12, 2
         53        CONCAT                                           ~47     '%5Bcontains%28concat%28%27+%27%2C%40class%2C%27+%27%29%2C+%27+', ~46
         54        CONCAT                                           ~48     ~47, '+%27%29%5D'
         55        ASSIGN_DIM                                               !10
         56        OP_DATA                                                  ~48
  110    57    >   INIT_FCALL                                               'substr'
         58        SEND_VAR                                                 !0
         59        FETCH_DIM_R                                      ~49     !12, 0
         60        STRLEN                                           ~50     ~49
         61        SEND_VAL                                                 ~50
         62        DO_ICALL                                         $51     
         63        ASSIGN                                                   !0, $51
  114    64    >   INIT_FCALL                                               'preg_match'
         65        SEND_VAR                                                 !5
         66        SEND_VAR                                                 !0
         67        SEND_REF                                                 !12
         68        DO_ICALL                                                 
  115    69        BOOL_NOT                                         ~54     !12
         70      > JMPZ                                                     ~54, ->76
         71    >   INIT_FCALL                                               'preg_match'
         72        SEND_VAR                                                 !4
         73        SEND_VAR                                                 !0
         74        SEND_REF                                                 !12
         75        DO_ICALL                                                 
  116    76    >   BOOL_NOT                                         ~56     !12
         77      > JMPZ                                                     ~56, ->83
         78    >   INIT_FCALL                                               'preg_match'
         79        SEND_VAR                                                 !3
         80        SEND_VAR                                                 !0
         81        SEND_REF                                                 !12
         82        DO_ICALL                                                 
  117    83    > > JMPZ                                                     !12, ->112
  119    84    >   FETCH_DIM_R                                      ~58     !12, 2
         85        IS_EQUAL                                                 ~58, '%7E%3D'
         86      > JMPZ                                                     ~59, ->96
  120    87    >   FETCH_DIM_R                                      ~61     !12, 1
         88        CONCAT                                           ~62     '%5Bcontains%28concat%28%27+%27%2C+%40', ~61
         89        CONCAT                                           ~63     ~62, '%2C+%27+%27%29%2C+%27+'
         90        FETCH_DIM_R                                      ~64     !12, 3
         91        CONCAT                                           ~65     ~63, ~64
         92        CONCAT                                           ~66     ~65, '+%27%29%5D'
         93        ASSIGN_DIM                                               !10
         94        OP_DATA                                                  ~66
         95      > JMP                                                      ->104
  122    96    >   FETCH_DIM_R                                      ~68     !12, 1
         97        CONCAT                                           ~69     '%5B%40', ~68
         98        CONCAT                                           ~70     ~69, '%3D%27'
         99        FETCH_DIM_R                                      ~71     !12, 3
        100        CONCAT                                           ~72     ~70, ~71
        101        CONCAT                                           ~73     ~72, '%27%5D'
        102        ASSIGN_DIM                                               !10
        103        OP_DATA                                                  ~73
  124   104    >   INIT_FCALL                                               'substr'
        105        SEND_VAR                                                 !0
        106        FETCH_DIM_R                                      ~74     !12, 0
        107        STRLEN                                           ~75     ~74
        108        SEND_VAL                                                 ~75
        109        DO_ICALL                                         $76     
        110        ASSIGN                                                   !0, $76
        111      > JMP                                                      ->130
  128   112    >   INIT_FCALL                                               'preg_match'
        113        SEND_VAR                                                 !2
        114        SEND_VAR                                                 !0
        115        SEND_REF                                                 !12
        116        DO_ICALL                                                 
  129   117      > JMPZ                                                     !12, ->130
  131   118    >   FETCH_DIM_R                                      ~80     !12, 1
        119        CONCAT                                           ~81     '%5B%40', ~80
        120        CONCAT                                           ~82     ~81, '%5D'
        121        ASSIGN_DIM                                               !10
        122        OP_DATA                                                  ~82
  132   123        INIT_FCALL                                               'substr'
        124        SEND_VAR                                                 !0
        125        FETCH_DIM_R                                      ~83     !12, 0
        126        STRLEN                                           ~84     ~83
        127        SEND_VAL                                                 ~84
        128        DO_ICALL                                         $85     
        129        ASSIGN                                                   !0, $85
  137   130    >   INIT_FCALL                                               'preg_match'
        131        SEND_VAR                                                 !6
        132        SEND_VAR                                                 !0
        133        SEND_REF                                                 !12
        134        DO_ICALL                                                 
  138   135      > JMP                                                      ->148
  152   136    >   INIT_FCALL                                               'substr'
        137        SEND_VAR                                                 !0
        138        FETCH_DIM_R                                      ~88     !12, 0
        139        STRLEN                                           ~89     ~88
        140        SEND_VAL                                                 ~89
        141        DO_ICALL                                         $90     
        142        ASSIGN                                                   !0, $90
  153   143        INIT_FCALL                                               'preg_match'
        144        SEND_VAR                                                 !6
        145        SEND_VAR                                                 !0
        146        SEND_REF                                                 !12
        147        DO_ICALL                                                 
  138   148    > > JMPNZ                                                    !12, ->136
  157   149    >   INIT_FCALL                                               'preg_match'
        150        SEND_VAR                                                 !7
        151        SEND_VAR                                                 !0
        152        SEND_REF                                                 !12
        153        DO_ICALL                                                 
  158   154      > JMPZ_EX                                          ~94     !12, ->158
        155    >   FETCH_DIM_R                                      ~95     !12, 0
        156        STRLEN                                           ~96     ~95
        157        BOOL                                             ~94     ~96
        158    > > JMPZ                                                     ~94, ->192
  160   159    >   INIT_FCALL                                               'strpos'
        160        FETCH_DIM_R                                      ~97     !12, 0
        161        SEND_VAL                                                 ~97
        162        SEND_VAL                                                 '%3E'
        163        DO_ICALL                                         $98     
        164        TYPE_CHECK                                  1018          $98
        165      > JMPZ                                                     ~99, ->169
  161   166    >   ASSIGN_DIM                                               !10
        167        OP_DATA                                                  '%2F'
        168      > JMP                                                      ->181
  162   169    >   INIT_FCALL                                               'strpos'
        170        FETCH_DIM_R                                      ~101    !12, 0
        171        SEND_VAL                                                 ~101
        172        SEND_VAL                                                 '%2B'
        173        DO_ICALL                                         $102    
        174        TYPE_CHECK                                  1018          $102
        175      > JMPZ                                                     ~103, ->179
  163   176    >   ASSIGN_DIM                                               !10
        177        OP_DATA                                                  '%2Ffollowing-sibling%3A%3A'
        178      > JMP                                                      ->181
  165   179    >   ASSIGN_DIM                                               !10
        180        OP_DATA                                                  '%2F%2F'
  167   181    >   COUNT                                            ~106    !10
        182        ASSIGN                                                   !9, ~106
  168   183        ASSIGN_DIM                                               !10
        184        OP_DATA                                                  '%2A'
  169   185        INIT_FCALL                                               'substr'
        186        SEND_VAR                                                 !0
        187        FETCH_DIM_R                                      ~109    !12, 0
        188        STRLEN                                           ~110    ~109
        189        SEND_VAL                                                 ~110
        190        DO_ICALL                                         $111    
        191        ASSIGN                                                   !0, $111
  172   192    >   INIT_FCALL                                               'preg_match'
        193        SEND_VAR                                                 !8
        194        SEND_VAR                                                 !0
        195        SEND_REF                                                 !12
        196        DO_ICALL                                                 
  173   197      > JMPZ                                                     !12, ->213
  175   198    >   ASSIGN_DIM                                               !10
        199        OP_DATA                                                  '+%7C+'
  176   200        ASSIGN_DIM                                               !10
        201        OP_DATA                                                  '.%2F%2F'
  177   202        COUNT                                            ~116    !10
        203        ASSIGN                                                   !9, ~116
  178   204        ASSIGN_DIM                                               !10
        205        OP_DATA                                                  '%2A'
  179   206        INIT_FCALL                                               'substr'
        207        SEND_VAR                                                 !0
        208        FETCH_DIM_R                                      ~119    !12, 0
        209        STRLEN                                           ~120    ~119
        210        SEND_VAL                                                 ~120
        211        DO_ICALL                                         $121    
        212        ASSIGN                                                   !0, $121
   84   213    > > JMPZ_EX                                          ~123    !0, ->216
        214    >   IS_NOT_IDENTICAL                                 ~124    !0, !11
        215        BOOL                                             ~123    ~124
        216    > > JMPNZ                                  

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.6 ms | 1428 KiB | 32 Q