3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html=<<<EOT <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>KvK NL - Uittreksel inzien</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" type="text/css" href="../css/style.css"/> <link rel="stylesheet" type="text/css" href="../css/uittreksel.css"/> <link rel="stylesheet" type="text/css" href="../css/printUittreksel.css" media="print"/> <script type="text/javascript" src="../resources/nl.kvk.hp.web.pages.InzienPage/google-analytics.js"></script> </head> <body class="hrfixed"> <div> </div> <div id="uittrekselWrapper"> <span><?xml version="1.0" encoding="UTF-8"?> <div id="uittreksel"></div></span> </div> <div id="footer"> </div> </body> </html> EOT; define('CONTENT_DOCUMENT_ID', 'uittreksel'); $html = '<?xml version="1.0" encoding="UTF-8"?>' . preg_replace('/(<\?xml[^!\?>]+\?>)/msi','', $html); try { $xml = new DOMDocument('1.0', 'UTF-8'); $xml->loadHTML($html); } catch (DOMException $e) { throw new exception('Document could not be generated, no html found'); } // get the part of the document we need $xpath = new DOMXPath($xml); if (!($content = $xpath->query("//*[@id='" . CONTENT_DOCUMENT_ID . "']")->item(0))) { throw new exception('Extract data is missing in document'); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 46
Branch analysis from position: 42
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 21
Branch analysis from position: 21
2 jumps found. (Code = 107) Position 1 = 22, Position 2 = -2
Branch analysis from position: 22
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/hDfan
function name:  (null)
number of ops:  47
compiled vars:  !0 = $html, !1 = $xml, !2 = $e, !3 = $xpath, !4 = $content
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%21DOCTYPE+html+PUBLIC+%22-%2F%2FW3C%2F%2FDTD+XHTML+1.0+Strict%2F%2FEN%22+%22http%3A%2F%2Fwww.w3.org%2FTR%2Fxhtml1%2FDTD%2Fxhtml1-strict.dtd%22%3E%0A%3Chtml+xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%3E%0A++++%3Chead%3E%0A++++++++%3Ctitle%3EKvK+NL+-+Uittreksel+inzien%3C%2Ftitle%3E%0A++++++++%3Cmeta+http-equiv%3D%22Content-Type%22+content%3D%22text%2Fhtml%3B+charset%3DUTF-8%22%2F%3E%0A++++%0A++++++++++++++++%3Clink+rel%3D%22stylesheet%22+type%3D%22text%2Fcss%22+href%3D%22..%2Fcss%2Fstyle.css%22%2F%3E%0A++++++++++++++++%3Clink+rel%3D%22stylesheet%22+type%3D%22text%2Fcss%22+href%3D%22..%2Fcss%2Fuittreksel.css%22%2F%3E%0A++++++++++++++++%3Clink+rel%3D%22stylesheet%22+type%3D%22text%2Fcss%22+href%3D%22..%2Fcss%2FprintUittreksel.css%22+media%3D%22print%22%2F%3E%0A++++++++%3Cscript+type%3D%22text%2Fjavascript%22+src%3D%22..%2Fresources%2Fnl.kvk.hp.web.pages.InzienPage%2Fgoogle-analytics.js%22%3E%3C%2Fscript%3E%0A%3C%2Fhead%3E%0A++++%3Cbody+class%3D%22hrfixed%22%3E%0A++++++++%3Cdiv%3E%0A++%0A%3C%2Fdiv%3E%0A++++++++%0A++++++++++++%0A++++++++++++%3Cdiv+id%3D%22uittrekselWrapper%22%3E%0A%0A++++++++++++++++++++++++%3Cspan%3E%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0A%3Cdiv+id%3D%22uittreksel%22%3E%3C%2Fdiv%3E%3C%2Fspan%3E++++++++%0A%0A++++++++%3C%2Fdiv%3E%0A++++++++%0A++++++++%0A++++++++%3Cdiv+id%3D%22footer%22%3E%0A++++++++++++++++%0A++++++++%3C%2Fdiv%3E%0A++++%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   36     1        INIT_FCALL                                               'define'
          2        SEND_VAL                                                 'CONTENT_DOCUMENT_ID'
          3        SEND_VAL                                                 'uittreksel'
          4        DO_ICALL                                                 
   37     5        INIT_FCALL                                               'preg_replace'
          6        SEND_VAL                                                 '%2F%28%3C%5C%3Fxml%5B%5E%21%5C%3F%3E%5D%2B%5C%3F%3E%29%2Fmsi'
          7        SEND_VAL                                                 ''
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $7      
         10        CONCAT                                           ~8      '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E', $7
         11        ASSIGN                                                   !0, ~8
   41    12        NEW                                              $10     'DOMDocument'
         13        SEND_VAL_EX                                              '1.0'
         14        SEND_VAL_EX                                              'UTF-8'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !1, $10
   42    17        INIT_METHOD_CALL                                         !1, 'loadHTML'
         18        SEND_VAR_EX                                              !0
         19        DO_FCALL                                      0          
         20      > JMP                                                      ->26
   44    21  E > > CATCH                                       last         'DOMException'
   46    22    >   NEW                                              $14     'exception'
         23        SEND_VAL_EX                                              'Document+could+not+be+generated%2C+no+html+found'
         24        DO_FCALL                                      0          
         25      > THROW                                         0          $14
   50    26    >   NEW                                              $16     'DOMXPath'
         27        SEND_VAR_EX                                              !1
         28        DO_FCALL                                      0          
         29        ASSIGN                                                   !3, $16
   52    30        INIT_METHOD_CALL                                         !3, 'query'
         31        FETCH_CONSTANT                                   ~19     'CONTENT_DOCUMENT_ID'
         32        CONCAT                                           ~20     '%2F%2F%2A%5B%40id%3D%27', ~19
         33        CONCAT                                           ~21     ~20, '%27%5D'
         34        SEND_VAL_EX                                              ~21
         35        DO_FCALL                                      0  $22     
         36        INIT_METHOD_CALL                                         $22, 'item'
         37        SEND_VAL_EX                                              0
         38        DO_FCALL                                      0  $23     
         39        ASSIGN                                           ~24     !4, $23
         40        BOOL_NOT                                         ~25     ~24
         41      > JMPZ                                                     ~25, ->46
   54    42    >   NEW                                              $26     'exception'
         43        SEND_VAL_EX                                              'Extract+data+is+missing+in+document'
         44        DO_FCALL                                      0          
         45      > THROW                                         0          $26
   55    46    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.98 ms | 1400 KiB | 17 Q