3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * What is the DOM Core Version is Supported by PHP DOM? */ $dom = new DOMDocument(); $dom->loadXML('<root/>'); $element = $dom->documentElement; function dom_list_feature(DOMDocument $dom, $feature, array $versions) { echo "$feature Feature is in PHP DOMDocument implementation:\n\n"; $found = array(); foreach ($versions as $i => $version) { $result = $dom->implementation->hasFeature($feature, $version); if ($result) { $found[] = $version; } printf(" %d.) $feature %' -5s: %s\n", $i + 1, var_export($version, true), $result ? 'TRUE' : 'FALSE'); } $count = count($found); printf("\n%s %s versions found%s.\n\n", $count, $feature, $found ? ': ' . implode('; ', $found) : ''); } # Test DOMDocument in PHP Support for DOM-Core Feature # Document Object Model (DOM) <http://www.w3.org/DOM/DOMTR> dom_list_feature($dom, "Core", array('3.0', '2.0', '1.0', '', NULL)); # Test DOMDocument in PHP Support for DOM-XPath Feature # Document Object Model XPath <http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html> dom_list_feature($dom, "XPath", array('3.0', '2.0', '1.0', '', NULL));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/15XY2
function name:  (null)
number of ops:  19
compiled vars:  !0 = $dom, !1 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $2      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    6     3        INIT_METHOD_CALL                                         !0, 'loadXML'
          4        SEND_VAL_EX                                              '%3Croot%2F%3E'
          5        DO_FCALL                                      0          
    8     6        FETCH_OBJ_R                                      ~6      !0, 'documentElement'
          7        ASSIGN                                                   !1, ~6
   33     8        INIT_FCALL                                               'dom_list_feature'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'Core'
         11        SEND_VAL                                                 <array>
         12        DO_FCALL                                      0          
   37    13        INIT_FCALL                                               'dom_list_feature'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 'XPath'
         16        SEND_VAL                                                 <array>
         17        DO_FCALL                                      0          
         18      > RETURN                                                   1

Function dom_list_feature:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 38
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 38
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 19
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 53
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
filename:       /in/15XY2
function name:  dom_list_feature
number of ops:  57
compiled vars:  !0 = $dom, !1 = $feature, !2 = $versions, !3 = $found, !4 = $version, !5 = $i, !6 = $result, !7 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   12     3        NOP                                                      
          4        FAST_CONCAT                                      ~8      !1, '+Feature+is+in+PHP+DOMDocument+implementation%3A%0A%0A'
          5        ECHO                                                     ~8
   14     6        ASSIGN                                                   !3, <array>
   17     7      > FE_RESET_R                                       $10     !2, ->38
          8    > > FE_FETCH_R                                       ~11     $10, !4, ->38
          9    >   ASSIGN                                                   !5, ~11
   19    10        FETCH_OBJ_R                                      ~13     !0, 'implementation'
         11        INIT_METHOD_CALL                                         ~13, 'hasFeature'
         12        SEND_VAR_EX                                              !1
         13        SEND_VAR_EX                                              !4
         14        DO_FCALL                                      0  $14     
         15        ASSIGN                                                   !6, $14
   20    16      > JMPZ                                                     !6, ->19
   21    17    >   ASSIGN_DIM                                               !3
         18        OP_DATA                                                  !4
   23    19    >   INIT_FCALL                                               'printf'
         20        ROPE_INIT                                     3  ~18     '++++%25d.%29+'
         21        ROPE_ADD                                      1  ~18     ~18, !1
         22        ROPE_END                                      2  ~17     ~18, '+%25%27+-5s%3A+%25s%0A'
         23        SEND_VAL                                                 ~17
         24        ADD                                              ~20     !5, 1
         25        SEND_VAL                                                 ~20
         26        INIT_FCALL                                               'var_export'
         27        SEND_VAR                                                 !4
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $21     
         30        SEND_VAR                                                 $21
         31      > JMPZ                                                     !6, ->34
         32    >   QM_ASSIGN                                        ~22     'TRUE'
         33      > JMP                                                      ->35
         34    >   QM_ASSIGN                                        ~22     'FALSE'
         35    >   SEND_VAL                                                 ~22
         36        DO_ICALL                                                 
   17    37      > JMP                                                      ->8
         38    >   FE_FREE                                                  $10
   27    39        COUNT                                            ~24     !3
         40        ASSIGN                                                   !7, ~24
   28    41        INIT_FCALL                                               'printf'
         42        SEND_VAL                                                 '%0A%25s+%25s+versions+found%25s.%0A%0A'
         43        SEND_VAR                                                 !7
         44        SEND_VAR                                                 !1
         45      > JMPZ                                                     !3, ->53
         46    >   INIT_FCALL                                               'implode'
         47        SEND_VAL                                                 '%3B+'
         48        SEND_VAR                                                 !3
         49        DO_ICALL                                         $26     
         50        CONCAT                                           ~27     '%3A+', $26
         51        QM_ASSIGN                                        ~28     ~27
         52      > JMP                                                      ->54
         53    >   QM_ASSIGN                                        ~28     ''
         54    >   SEND_VAL                                                 ~28
         55        DO_ICALL                                                 
   29    56      > RETURN                                                   null

End of function dom_list_feature

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.86 ms | 1398 KiB | 21 Q