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 = []; 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'); } $formatter = new NumberFormatter('en_UK', NumberFormatter::SPELLOUT); $count = ucfirst($formatter->format($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", ['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", ['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/i43s6
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
   34     8        INIT_FCALL                                               'dom_list_feature'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'Core'
         11        SEND_VAL                                                 <array>
         12        DO_FCALL                                      0          
   38    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 = 57, Position 2 = 64
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
filename:       /in/i43s6
function name:  dom_list_feature
number of ops:  68
compiled vars:  !0 = $dom, !1 = $feature, !2 = $versions, !3 = $found, !4 = $version, !5 = $i, !6 = $result, !7 = $formatter, !8 = $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                                      ~9      !1, '+Feature+is+in+PHP+DOMDocument+implementation%3A%0A%0A'
          5        ECHO                                                     ~9
   14     6        ASSIGN                                                   !3, <array>
   17     7      > FE_RESET_R                                       $11     !2, ->38
          8    > > FE_FETCH_R                                       ~12     $11, !4, ->38
          9    >   ASSIGN                                                   !5, ~12
   19    10        FETCH_OBJ_R                                      ~14     !0, 'implementation'
         11        INIT_METHOD_CALL                                         ~14, 'hasFeature'
         12        SEND_VAR_EX                                              !1
         13        SEND_VAR_EX                                              !4
         14        DO_FCALL                                      0  $15     
         15        ASSIGN                                                   !6, $15
   20    16      > JMPZ                                                     !6, ->19
   21    17    >   ASSIGN_DIM                                               !3
         18        OP_DATA                                                  !4
   23    19    >   INIT_FCALL                                               'printf'
         20        ROPE_INIT                                     3  ~19     '++++%25d.%29+'
         21        ROPE_ADD                                      1  ~19     ~19, !1
         22        ROPE_END                                      2  ~18     ~19, '+%25%27+-5s%3A+%25s%0A'
         23        SEND_VAL                                                 ~18
         24        ADD                                              ~21     !5, 1
         25        SEND_VAL                                                 ~21
         26        INIT_FCALL                                               'var_export'
         27        SEND_VAR                                                 !4
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $22     
         30        SEND_VAR                                                 $22
         31      > JMPZ                                                     !6, ->34
         32    >   QM_ASSIGN                                        ~23     'TRUE'
         33      > JMP                                                      ->35
         34    >   QM_ASSIGN                                        ~23     'FALSE'
         35    >   SEND_VAL                                                 ~23
         36        DO_ICALL                                                 
   17    37      > JMP                                                      ->8
         38    >   FE_FREE                                                  $11
   27    39        NEW                                              $25     'NumberFormatter'
         40        SEND_VAL_EX                                              'en_UK'
         41        FETCH_CLASS_CONSTANT                             ~26     'NumberFormatter', 'SPELLOUT'
         42        SEND_VAL_EX                                              ~26
         43        DO_FCALL                                      0          
         44        ASSIGN                                                   !7, $25
   28    45        INIT_FCALL                                               'ucfirst'
         46        INIT_METHOD_CALL                                         !7, 'format'
         47        SEND_VAR_EX                                              !3
         48        DO_FCALL                                      0  $29     
         49        SEND_VAR                                                 $29
         50        DO_ICALL                                         $30     
         51        ASSIGN                                                   !8, $30
   29    52        INIT_FCALL                                               'printf'
         53        SEND_VAL                                                 '%0A%25s+%25s+versions+found%25s.%0A%0A'
         54        SEND_VAR                                                 !8
         55        SEND_VAR                                                 !1
         56      > JMPZ                                                     !3, ->64
         57    >   INIT_FCALL                                               'implode'
         58        SEND_VAL                                                 '%3B+'
         59        SEND_VAR                                                 !3
         60        DO_ICALL                                         $32     
         61        CONCAT                                           ~33     '%3A+', $32
         62        QM_ASSIGN                                        ~34     ~33
         63      > JMP                                                      ->65
         64    >   QM_ASSIGN                                        ~34     ''
         65    >   SEND_VAL                                                 ~34
         66        DO_ICALL                                                 
   30    67      > RETURN                                                   null

End of function dom_list_feature

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.65 ms | 1407 KiB | 23 Q