3v4l.org

run code in 500+ PHP versions simultaneously
<?php echo "Testing DOMDocument::createElement() with strictErrorChecking:\n"; echo "PHP Version: " . PHP_VERSION . "\n\n"; function testWithStrictMode($strict) { $doc = new DOMDocument(); $doc->strictErrorChecking = $strict; echo "=== strictErrorChecking = " . ($strict ? "TRUE" : "FALSE") . " ===\n"; $testCases = [ ['123element', 'Name starting with digit'], ['my element', 'Name with space'], ['my@element', 'Name with @ symbol'], ['', 'Empty name'], ['!element', 'Name with exclamation'], ['elem&ent', 'Name with ampersand'], ['.element', 'Name starting with dot'], ['-element', 'Name starting with hyphen'], ['validElement', 'Valid name'], ]; foreach ($testCases as [$name, $desc]) { echo str_pad("$desc ('$name'):", 40); try { $result = $doc->createElement($name); if ($result === false) { echo "Returned FALSE\n"; } else { echo "SUCCESS (" . $result->nodeName . ")\n"; } } catch (DOMException $e) { echo "EXCEPTION: " . $e->getMessage() . "\n"; } } echo "\n"; } // Test with strict error checking enabled (default) testWithStrictMode(true); // Test with strict error checking disabled (legacy behavior) testWithStrictMode(false);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vI5Z0
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                         'Testing+DOMDocument%3A%3AcreateElement%28%29+with+strictErrorChecking%3A%0A'
    4     1        ECHO                                                         'PHP+Version%3A+8.5.0%0A%0A'
   41     2        INIT_FCALL                                                   'testwithstrictmode'
          3        SEND_VAL                                                     <true>
          4        DO_FCALL                                          0          
   44     5        INIT_FCALL                                                   'testwithstrictmode'
          6        SEND_VAL                                                     <false>
          7        DO_FCALL                                          0          
          8      > RETURN                                                       1

Function testwithstrictmode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 50
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 50
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 38
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 50
Branch analysis from position: 15
Branch analysis from position: 50
Found catch point at position: 43
Branch analysis from position: 43
2 jumps found. (Code = 107) Position 1 = 44, Position 2 = -2
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
filename:       /in/vI5Z0
function name:  testWithStrictMode
number of ops:  53
compiled vars:  !0 = $strict, !1 = $doc, !2 = $testCases, !3 = $name, !4 = $desc, !5 = $result, !6 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        NEW                                                  $7      'DOMDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $7
    8     4        ASSIGN_OBJ                                                   !1, 'strictErrorChecking'
          5        OP_DATA                                                      !0
   10     6      > JMPZ                                                         !0, ->9
          7    >   QM_ASSIGN                                            ~11     'TRUE'
          8      > JMP                                                          ->10
          9    >   QM_ASSIGN                                            ~11     'FALSE'
         10    >   CONCAT                                               ~12     '%3D%3D%3D+strictErrorChecking+%3D+', ~11
         11        CONCAT                                               ~13     ~12, '+%3D%3D%3D%0A'
         12        ECHO                                                         ~13
   12    13        ASSIGN                                                       !2, <array>
   24    14      > FE_RESET_R                                           $15     !2, ->50
         15    > > FE_FETCH_R                                                   $15, $16, ->50
         16    >   FETCH_LIST_R                                         $17     $16, 0
         17        ASSIGN                                                       !3, $17
         18        FETCH_LIST_R                                         $19     $16, 1
         19        ASSIGN                                                       !4, $19
         20        FREE                                                         $16
   25    21        INIT_FCALL                                                   'str_pad'
         22        ROPE_INIT                                         4  ~22     !4
         23        ROPE_ADD                                          1  ~22     ~22, '+%28%27'
         24        ROPE_ADD                                          2  ~22     ~22, !3
         25        ROPE_END                                          3  ~21     ~22, '%27%29%3A'
         26        SEND_VAL                                                     ~21
         27        SEND_VAL                                                     40
         28        DO_ICALL                                             $24     
         29        ECHO                                                         $24
   27    30        INIT_METHOD_CALL                                             !1, 'createElement'
         31        SEND_VAR_EX                                                  !3
         32        DO_FCALL                                          0  $25     
         33        ASSIGN                                                       !5, $25
   28    34        TYPE_CHECK                                        4          !5
         35      > JMPZ                                                         ~27, ->38
   29    36    >   ECHO                                                         'Returned+FALSE%0A'
   28    37      > JMP                                                          ->42
   31    38    >   FETCH_OBJ_R                                          ~28     !5, 'nodeName'
         39        CONCAT                                               ~29     'SUCCESS+%28', ~28
         40        CONCAT                                               ~30     ~29, '%29%0A'
         41        ECHO                                                         ~30
         42    > > JMP                                                          ->49
   33    43  E > > CATCH                                           last         'DOMException'
   34    44    >   INIT_METHOD_CALL                                             !6, 'getMessage'
         45        DO_FCALL                                          0  $31     
         46        CONCAT                                               ~32     'EXCEPTION%3A+', $31
         47        CONCAT                                               ~33     ~32, '%0A'
         48        ECHO                                                         ~33
   24    49    > > JMP                                                          ->15
         50    >   FE_FREE                                                      $15
   37    51        ECHO                                                         '%0A'
   38    52      > RETURN                                                       null

End of function testwithstrictmode

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.19 ms | 1634 KiB | 15 Q