3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<!DOCTYPE html> <html> <head></head> <body> <h1>Some Text</h1> <p>This is the first Paragraph</p> <ul> <li></li> <li></l1> </ul> <p>This is the second Pharagraph</p> </body> </html>'; $err = libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML($html); libxml_clear_errors(); libxml_use_internal_errors($err); // find all p tags, select the first, get its value $pValue = $dom->getElementsByTagName('p')->item(0)->nodeValue; //This is the first Paragraph echo $pValue;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kjFoC
function name:  (null)
number of ops:  26
compiled vars:  !0 = $html, !1 = $err, !2 = $dom, !3 = $pValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3C%21DOCTYPE+html%3E%0A%3Chtml%3E%0A++%3Chead%3E%3C%2Fhead%3E%0A++%3Cbody%3E%0A++++%3Ch1%3ESome+Text%3C%2Fh1%3E%0A++++%3Cp%3EThis+is+the+first+Paragraph%3C%2Fp%3E%0A++++%3Cul%3E%0A++++++%3Cli%3E%3C%2Fli%3E%0A++++++%3Cli%3E%3C%2Fl1%3E%0A++++%3C%2Ful%3E%0A++++%3Cp%3EThis+is+the+second+Pharagraph%3C%2Fp%3E%0A++%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   16     1        INIT_FCALL                                               'libxml_use_internal_errors'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   17     5        NEW                                              $7      'DOMDocument'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $7
   18     8        INIT_METHOD_CALL                                         !2, 'loadHTML'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
   19    11        INIT_FCALL                                               'libxml_clear_errors'
         12        DO_ICALL                                                 
   20    13        INIT_FCALL                                               'libxml_use_internal_errors'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
   23    16        INIT_METHOD_CALL                                         !2, 'getElementsByTagName'
         17        SEND_VAL_EX                                              'p'
         18        DO_FCALL                                      0  $13     
         19        INIT_METHOD_CALL                                         $13, 'item'
         20        SEND_VAL_EX                                              0
         21        DO_FCALL                                      0  $14     
         22        FETCH_OBJ_R                                      ~15     $14, 'nodeValue'
         23        ASSIGN                                                   !3, ~15
   26    24        ECHO                                                     !3
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.95 ms | 1006 KiB | 15 Q