3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = "<p class='xdescriptionx'><a data-ct='campaign_softlayer_inarticle_ad' target='_blank' href='someurl'><img class='lazy-img description' src='someurl' data-original='someurl' /></a></p>"; $dom = new DomDocument(); $dom->loadHtml($foo); $finder = new DomXPath($dom); $classname="description"; $nodes = $finder->query("//p[contains(@class, '$classname')]"); var_dump($nodes->length);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bmu63
function name:  (null)
number of ops:  24
compiled vars:  !0 = $foo, !1 = $dom, !2 = $finder, !3 = $classname, !4 = $nodes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cp+class%3D%27xdescriptionx%27%3E%3Ca+data-ct%3D%27campaign_softlayer_inarticle_ad%27+target%3D%27_blank%27+href%3D%27someurl%27%3E%3Cimg+class%3D%27lazy-img+description%27+src%3D%27someurl%27+data-original%3D%27someurl%27+%2F%3E%3C%2Fa%3E%3C%2Fp%3E'
    5     1        NEW                                              $6      'DomDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $6
    6     4        INIT_METHOD_CALL                                         !1, 'loadHtml'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
    7     7        NEW                                              $10     'DomXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $10
    8    11        ASSIGN                                                   !3, 'description'
    9    12        INIT_METHOD_CALL                                         !2, 'query'
         13        ROPE_INIT                                     3  ~15     '%2F%2Fp%5Bcontains%28%40class%2C+%27'
         14        ROPE_ADD                                      1  ~15     ~15, !3
         15        ROPE_END                                      2  ~14     ~15, '%27%29%5D'
         16        SEND_VAL_EX                                              ~14
         17        DO_FCALL                                      0  $17     
         18        ASSIGN                                                   !4, $17
   11    19        INIT_FCALL                                               'var_dump'
         20        FETCH_OBJ_R                                      ~19     !4, 'length'
         21        SEND_VAL                                                 ~19
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.39 ms | 1395 KiB | 15 Q