3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dom = Dom\HTMLDocument::createFromString("<svg width=\"1\">"); $el = $dom->getElementsByTagName('svg')[0]; $attribute = $el->attributes->item(0); $rm = new ReflectionMethod($attribute, "__construct"); $rm->invoke($attribute);
Output for 8.1.32 - 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.35
Fatal error: Uncaught Error: Class "Dom\HTMLDocument" not found in /in/uNfoU:2 Stack trace: #0 {main} thrown in /in/uNfoU on line 2
Process exited with code 255.
Output for 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
Warning: Dom\HTMLDocument::createFromString(): tree error unexpected-token-in-initial-mode in Entity, line: 1, column: 2-4 in /in/uNfoU on line 2 Fatal error: Uncaught Error: Cannot directly construct Dom\Attr, use document methods instead in /in/uNfoU:6 Stack trace: #0 [internal function]: Dom\Node->__construct() #1 /in/uNfoU(6): ReflectionMethod->invoke(Object(Dom\Attr)) #2 {main} thrown in /in/uNfoU on line 6
Process exited with code 255.

preferences:
32.11 ms | 1140 KiB | 9 Q