3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $errored = FALSE; set_error_handler(function ($errno, $errstr) use (&$errored) { $errored = TRUE; return TRUE; }); $excludedClasses = [ // These cause fatal errors on instantiation "Closure", "SQLite3", "Filter", "PDO" ]; var_dump( array_filter( get_declared_classes(), function ($className) use (&$errored, $excludedClasses) { $errored = FALSE; $class = new ReflectionClass($className); if (!$class->isInstantiable() || $class->hasMethod('__construct') && (new ReflectionMethod("$className::__construct"))->isPrivate()) { return FALSE; } foreach ($excludedClasses as $bannedClass) { if (substr($className, 0, strlen($bannedClass)) === $bannedClass) { return FALSE; } } if (!(new ReflectionClass($className))->hasMethod('__toString')) { try { $x = new $className; $x = (string)$x; return $errored; } catch (Exception $e) { return FALSE; } } return FALSE; } ) );
based on RcDXF
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: The "Generator" class is reserved for internal use and cannot be manually instantiated in /in/GgYLj:31 Stack trace: #0 [internal function]: {closure}('Generator') #1 /in/GgYLj(39): array_filter(Array, Object(Closure)) #2 {main} thrown in /in/GgYLj on line 31
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: clone called on non-object in /in/GgYLj on line 31
Output for 5.6.28
array(64) { [0]=> string(8) "stdClass" [4]=> string(9) "Generator" [5]=> string(8) "DateTime" [6]=> string(17) "DateTimeImmutable" [10]=> string(11) "LibXMLError" [15]=> string(13) "DOMStringList" [16]=> string(11) "DOMNameList" [17]=> string(21) "DOMImplementationList" [18]=> string(23) "DOMImplementationSource" [19]=> string(17) "DOMImplementation" [20]=> string(7) "DOMNode" [21]=> string(16) "DOMNameSpaceNode" [22]=> string(19) "DOMDocumentFragment" [23]=> string(11) "DOMDocument" [24]=> string(11) "DOMNodeList" [25]=> string(15) "DOMNamedNodeMap" [26]=> string(16) "DOMCharacterData" [29]=> string(7) "DOMText" [30]=> string(10) "DOMComment" [31]=> string(11) "DOMTypeinfo" [32]=> string(18) "DOMUserDataHandler" [33]=> string(11) "DOMDomError" [34]=> string(15) "DOMErrorHandler" [35]=> string(10) "DOMLocator" [36]=> string(16) "DOMConfiguration" [38]=> string(15) "DOMDocumentType" [39]=> string(11) "DOMNotation" [40]=> string(9) "DOMEntity" [43]=> string(15) "DOMStringExtend" [45]=> string(5) "finfo" [70]=> string(14) "AppendIterator" [74]=> string(13) "EmptyIterator" [76]=> string(11) "ArrayObject" [77]=> string(13) "ArrayIterator" [78]=> string(22) "RecursiveArrayIterator" [86]=> string(19) "SplDoublyLinkedList" [87]=> string(8) "SplQueue" [88]=> string(8) "SplStack" [90]=> string(10) "SplMinHeap" [91]=> string(10) "SplMaxHeap" [92]=> string(16) "SplPriorityQueue" [93]=> string(13) "SplFixedArray" [94]=> string(16) "SplObjectStorage" [95]=> string(16) "MultipleIterator" [100]=> string(14) "SessionHandler" [102]=> string(10) "Reflection" [112]=> string(22) "__PHP_Incomplete_Class" [113]=> string(15) "php_user_filter" [114]=> string(9) "Directory" [121]=> string(9) "XMLReader" [122]=> string(9) "XMLWriter" [124]=> string(8) "Collator" [125]=> string(15) "NumberFormatter" [126]=> string(10) "Normalizer" [127]=> string(6) "Locale" [128]=> string(16) "MessageFormatter" [129]=> string(17) "IntlDateFormatter" [130]=> string(14) "ResourceBundle" [134]=> string(21) "IntlGregorianCalendar" [135]=> string(12) "Spoofchecker" [137]=> string(12) "IntlIterator" [139]=> string(26) "IntlRuleBasedBreakIterator" [141]=> string(17) "IntlPartsIterator" [142]=> string(10) "UConverter" }
Output for 5.5.24 - 5.5.28, 5.5.35, 5.6.21
array(64) { [0]=> string(8) "stdClass" [4]=> string(9) "Generator" [5]=> string(8) "DateTime" [6]=> string(17) "DateTimeImmutable" [10]=> string(11) "LibXMLError" [15]=> string(13) "DOMStringList" [16]=> string(11) "DOMNameList" [17]=> string(21) "DOMImplementationList" [18]=> string(23) "DOMImplementationSource" [19]=> string(17) "DOMImplementation" [20]=> string(7) "DOMNode" [21]=> string(16) "DOMNameSpaceNode" [22]=> string(19) "DOMDocumentFragment" [23]=> string(11) "DOMDocument" [24]=> string(11) "DOMNodeList" [25]=> string(15) "DOMNamedNodeMap" [26]=> string(16) "DOMCharacterData" [29]=> string(7) "DOMText" [30]=> string(10) "DOMComment" [31]=> string(11) "DOMTypeinfo" [32]=> string(18) "DOMUserDataHandler" [33]=> string(11) "DOMDomError" [34]=> string(15) "DOMErrorHandler" [35]=> string(10) "DOMLocator" [36]=> string(16) "DOMConfiguration" [38]=> string(15) "DOMDocumentType" [39]=> string(11) "DOMNotation" [40]=> string(9) "DOMEntity" [43]=> string(15) "DOMStringExtend" [45]=> string(5) "finfo" [70]=> string(14) "AppendIterator" [74]=> string(13) "EmptyIterator" [76]=> string(11) "ArrayObject" [77]=> string(13) "ArrayIterator" [78]=> string(22) "RecursiveArrayIterator" [86]=> string(19) "SplDoublyLinkedList" [87]=> string(8) "SplQueue" [88]=> string(8) "SplStack" [90]=> string(10) "SplMinHeap" [91]=> string(10) "SplMaxHeap" [92]=> string(16) "SplPriorityQueue" [93]=> string(13) "SplFixedArray" [94]=> string(16) "SplObjectStorage" [95]=> string(16) "MultipleIterator" [100]=> string(14) "SessionHandler" [102]=> string(10) "Reflection" [112]=> string(22) "__PHP_Incomplete_Class" [113]=> string(15) "php_user_filter" [114]=> string(9) "Directory" [121]=> string(9) "XMLReader" [122]=> string(9) "XMLWriter" [123]=> string(8) "Collator" [124]=> string(15) "NumberFormatter" [125]=> string(10) "Normalizer" [126]=> string(6) "Locale" [127]=> string(16) "MessageFormatter" [128]=> string(17) "IntlDateFormatter" [129]=> string(14) "ResourceBundle" [133]=> string(21) "IntlGregorianCalendar" [134]=> string(12) "Spoofchecker" [136]=> string(12) "IntlIterator" [138]=> string(26) "IntlRuleBasedBreakIterator" [140]=> string(17) "IntlPartsIterator" [141]=> string(10) "UConverter" }
Output for 5.6.13 - 5.6.15, 5.6.20
array(51) { [0]=> string(8) "stdClass" [4]=> string(9) "Generator" [5]=> string(8) "DateTime" [6]=> string(17) "DateTimeImmutable" [10]=> string(11) "LibXMLError" [15]=> string(13) "DOMStringList" [16]=> string(11) "DOMNameList" [17]=> string(21) "DOMImplementationList" [18]=> string(23) "DOMImplementationSource" [19]=> string(17) "DOMImplementation" [20]=> string(7) "DOMNode" [21]=> string(16) "DOMNameSpaceNode" [22]=> string(19) "DOMDocumentFragment" [23]=> string(11) "DOMDocument" [24]=> string(11) "DOMNodeList" [25]=> string(15) "DOMNamedNodeMap" [26]=> string(16) "DOMCharacterData" [29]=> string(7) "DOMText" [30]=> string(10) "DOMComment" [31]=> string(11) "DOMTypeinfo" [32]=> string(18) "DOMUserDataHandler" [33]=> string(11) "DOMDomError" [34]=> string(15) "DOMErrorHandler" [35]=> string(10) "DOMLocator" [36]=> string(16) "DOMConfiguration" [38]=> string(15) "DOMDocumentType" [39]=> string(11) "DOMNotation" [40]=> string(9) "DOMEntity" [43]=> string(15) "DOMStringExtend" [45]=> string(5) "finfo" [71]=> string(14) "AppendIterator" [75]=> string(13) "EmptyIterator" [77]=> string(11) "ArrayObject" [78]=> string(13) "ArrayIterator" [79]=> string(22) "RecursiveArrayIterator" [87]=> string(19) "SplDoublyLinkedList" [88]=> string(8) "SplQueue" [89]=> string(8) "SplStack" [91]=> string(10) "SplMinHeap" [92]=> string(10) "SplMaxHeap" [93]=> string(16) "SplPriorityQueue" [94]=> string(13) "SplFixedArray" [95]=> string(16) "SplObjectStorage" [96]=> string(16) "MultipleIterator" [101]=> string(14) "SessionHandler" [103]=> string(10) "Reflection" [113]=> string(22) "__PHP_Incomplete_Class" [114]=> string(15) "php_user_filter" [115]=> string(9) "Directory" [122]=> string(9) "XMLReader" [123]=> string(9) "XMLWriter" }
Output for 5.6.16 - 5.6.19
array(64) { [0]=> string(8) "stdClass" [4]=> string(9) "Generator" [5]=> string(8) "DateTime" [6]=> string(17) "DateTimeImmutable" [10]=> string(11) "LibXMLError" [15]=> string(13) "DOMStringList" [16]=> string(11) "DOMNameList" [17]=> string(21) "DOMImplementationList" [18]=> string(23) "DOMImplementationSource" [19]=> string(17) "DOMImplementation" [20]=> string(7) "DOMNode" [21]=> string(16) "DOMNameSpaceNode" [22]=> string(19) "DOMDocumentFragment" [23]=> string(11) "DOMDocument" [24]=> string(11) "DOMNodeList" [25]=> string(15) "DOMNamedNodeMap" [26]=> string(16) "DOMCharacterData" [29]=> string(7) "DOMText" [30]=> string(10) "DOMComment" [31]=> string(11) "DOMTypeinfo" [32]=> string(18) "DOMUserDataHandler" [33]=> string(11) "DOMDomError" [34]=> string(15) "DOMErrorHandler" [35]=> string(10) "DOMLocator" [36]=> string(16) "DOMConfiguration" [38]=> string(15) "DOMDocumentType" [39]=> string(11) "DOMNotation" [40]=> string(9) "DOMEntity" [43]=> string(15) "DOMStringExtend" [45]=> string(5) "finfo" [47]=> string(8) "Collator" [48]=> string(15) "NumberFormatter" [49]=> string(10) "Normalizer" [50]=> string(6) "Locale" [51]=> string(16) "MessageFormatter" [52]=> string(17) "IntlDateFormatter" [53]=> string(14) "ResourceBundle" [57]=> string(21) "IntlGregorianCalendar" [58]=> string(12) "Spoofchecker" [60]=> string(12) "IntlIterator" [62]=> string(26) "IntlRuleBasedBreakIterator" [64]=> string(17) "IntlPartsIterator" [65]=> string(10) "UConverter" [90]=> string(14) "AppendIterator" [94]=> string(13) "EmptyIterator" [96]=> string(11) "ArrayObject" [97]=> string(13) "ArrayIterator" [98]=> string(22) "RecursiveArrayIterator" [106]=> string(19) "SplDoublyLinkedList" [107]=> string(8) "SplQueue" [108]=> string(8) "SplStack" [110]=> string(10) "SplMinHeap" [111]=> string(10) "SplMaxHeap" [112]=> string(16) "SplPriorityQueue" [113]=> string(13) "SplFixedArray" [114]=> string(16) "SplObjectStorage" [115]=> string(16) "MultipleIterator" [120]=> string(14) "SessionHandler" [122]=> string(10) "Reflection" [132]=> string(22) "__PHP_Incomplete_Class" [133]=> string(15) "php_user_filter" [134]=> string(9) "Directory" [141]=> string(9) "XMLReader" [142]=> string(9) "XMLWriter" }
Output for 5.6.7 - 5.6.12
array(64) { [0]=> string(8) "stdClass" [4]=> string(9) "Generator" [5]=> string(8) "DateTime" [6]=> string(17) "DateTimeImmutable" [10]=> string(11) "LibXMLError" [15]=> string(13) "DOMStringList" [16]=> string(11) "DOMNameList" [17]=> string(21) "DOMImplementationList" [18]=> string(23) "DOMImplementationSource" [19]=> string(17) "DOMImplementation" [20]=> string(7) "DOMNode" [21]=> string(16) "DOMNameSpaceNode" [22]=> string(19) "DOMDocumentFragment" [23]=> string(11) "DOMDocument" [24]=> string(11) "DOMNodeList" [25]=> string(15) "DOMNamedNodeMap" [26]=> string(16) "DOMCharacterData" [29]=> string(7) "DOMText" [30]=> string(10) "DOMComment" [31]=> string(11) "DOMTypeinfo" [32]=> string(18) "DOMUserDataHandler" [33]=> string(11) "DOMDomError" [34]=> string(15) "DOMErrorHandler" [35]=> string(10) "DOMLocator" [36]=> string(16) "DOMConfiguration" [38]=> string(15) "DOMDocumentType" [39]=> string(11) "DOMNotation" [40]=> string(9) "DOMEntity" [43]=> string(15) "DOMStringExtend" [45]=> string(5) "finfo" [71]=> string(14) "AppendIterator" [75]=> string(13) "EmptyIterator" [77]=> string(11) "ArrayObject" [78]=> string(13) "ArrayIterator" [79]=> string(22) "RecursiveArrayIterator" [87]=> string(19) "SplDoublyLinkedList" [88]=> string(8) "SplQueue" [89]=> string(8) "SplStack" [91]=> string(10) "SplMinHeap" [92]=> string(10) "SplMaxHeap" [93]=> string(16) "SplPriorityQueue" [94]=> string(13) "SplFixedArray" [95]=> string(16) "SplObjectStorage" [96]=> string(16) "MultipleIterator" [101]=> string(14) "SessionHandler" [103]=> string(10) "Reflection" [113]=> string(22) "__PHP_Incomplete_Class" [114]=> string(15) "php_user_filter" [115]=> string(9) "Directory" [122]=> string(9) "XMLReader" [123]=> string(9) "XMLWriter" [124]=> string(8) "Collator" [125]=> string(15) "NumberFormatter" [126]=> string(10) "Normalizer" [127]=> string(6) "Locale" [128]=> string(16) "MessageFormatter" [129]=> string(17) "IntlDateFormatter" [130]=> string(14) "ResourceBundle" [134]=> string(21) "IntlGregorianCalendar" [135]=> string(12) "Spoofchecker" [137]=> string(12) "IntlIterator" [139]=> string(26) "IntlRuleBasedBreakIterator" [141]=> string(17) "IntlPartsIterator" [142]=> string(10) "UConverter" }
Output for 5.5.29 - 5.5.30, 5.5.34
array(51) { [0]=> string(8) "stdClass" [4]=> string(9) "Generator" [5]=> string(8) "DateTime" [6]=> string(17) "DateTimeImmutable" [10]=> string(11) "LibXMLError" [15]=> string(13) "DOMStringList" [16]=> string(11) "DOMNameList" [17]=> string(21) "DOMImplementationList" [18]=> string(23) "DOMImplementationSource" [19]=> string(17) "DOMImplementation" [20]=> string(7) "DOMNode" [21]=> string(16) "DOMNameSpaceNode" [22]=> string(19) "DOMDocumentFragment" [23]=> string(11) "DOMDocument" [24]=> string(11) "DOMNodeList" [25]=> string(15) "DOMNamedNodeMap" [26]=> string(16) "DOMCharacterData" [29]=> string(7) "DOMText" [30]=> string(10) "DOMComment" [31]=> string(11) "DOMTypeinfo" [32]=> string(18) "DOMUserDataHandler" [33]=> string(11) "DOMDomError" [34]=> string(15) "DOMErrorHandler" [35]=> string(10) "DOMLocator" [36]=> string(16) "DOMConfiguration" [38]=> string(15) "DOMDocumentType" [39]=> string(11) "DOMNotation" [40]=> string(9) "DOMEntity" [43]=> string(15) "DOMStringExtend" [45]=> string(5) "finfo" [70]=> string(14) "AppendIterator" [74]=> string(13) "EmptyIterator" [76]=> string(11) "ArrayObject" [77]=> string(13) "ArrayIterator" [78]=> string(22) "RecursiveArrayIterator" [86]=> string(19) "SplDoublyLinkedList" [87]=> string(8) "SplQueue" [88]=> string(8) "SplStack" [90]=> string(10) "SplMinHeap" [91]=> string(10) "SplMaxHeap" [92]=> string(16) "SplPriorityQueue" [93]=> string(13) "SplFixedArray" [94]=> string(16) "SplObjectStorage" [95]=> string(16) "MultipleIterator" [100]=> string(14) "SessionHandler" [102]=> string(10) "Reflection" [112]=> string(22) "__PHP_Incomplete_Class" [113]=> string(15) "php_user_filter" [114]=> string(9) "Directory" [121]=> string(9) "XMLReader" [122]=> string(9) "XMLWriter" }
Output for 5.5.31 - 5.5.33
array(64) { [0]=> string(8) "stdClass" [4]=> string(9) "Generator" [5]=> string(8) "DateTime" [6]=> string(17) "DateTimeImmutable" [10]=> string(11) "LibXMLError" [15]=> string(13) "DOMStringList" [16]=> string(11) "DOMNameList" [17]=> string(21) "DOMImplementationList" [18]=> string(23) "DOMImplementationSource" [19]=> string(17) "DOMImplementation" [20]=> string(7) "DOMNode" [21]=> string(16) "DOMNameSpaceNode" [22]=> string(19) "DOMDocumentFragment" [23]=> string(11) "DOMDocument" [24]=> string(11) "DOMNodeList" [25]=> string(15) "DOMNamedNodeMap" [26]=> string(16) "DOMCharacterData" [29]=> string(7) "DOMText" [30]=> string(10) "DOMComment" [31]=> string(11) "DOMTypeinfo" [32]=> string(18) "DOMUserDataHandler" [33]=> string(11) "DOMDomError" [34]=> string(15) "DOMErrorHandler" [35]=> string(10) "DOMLocator" [36]=> string(16) "DOMConfiguration" [38]=> string(15) "DOMDocumentType" [39]=> string(11) "DOMNotation" [40]=> string(9) "DOMEntity" [43]=> string(15) "DOMStringExtend" [45]=> string(5) "finfo" [46]=> string(8) "Collator" [47]=> string(15) "NumberFormatter" [48]=> string(10) "Normalizer" [49]=> string(6) "Locale" [50]=> string(16) "MessageFormatter" [51]=> string(17) "IntlDateFormatter" [52]=> string(14) "ResourceBundle" [56]=> string(21) "IntlGregorianCalendar" [57]=> string(12) "Spoofchecker" [59]=> string(12) "IntlIterator" [61]=> string(26) "IntlRuleBasedBreakIterator" [63]=> string(17) "IntlPartsIterator" [64]=> string(10) "UConverter" [89]=> string(14) "AppendIterator" [93]=> string(13) "EmptyIterator" [95]=> string(11) "ArrayObject" [96]=> string(13) "ArrayIterator" [97]=> string(22) "RecursiveArrayIterator" [105]=> string(19) "SplDoublyLinkedList" [106]=> string(8) "SplQueue" [107]=> string(8) "SplStack" [109]=> string(10) "SplMinHeap" [110]=> string(10) "SplMaxHeap" [111]=> string(16) "SplPriorityQueue" [112]=> string(13) "SplFixedArray" [113]=> string(16) "SplObjectStorage" [114]=> string(16) "MultipleIterator" [119]=> string(14) "SessionHandler" [121]=> string(10) "Reflection" [131]=> string(22) "__PHP_Incomplete_Class" [132]=> string(15) "php_user_filter" [133]=> string(9) "Directory" [140]=> string(9) "XMLReader" [141]=> string(9) "XMLWriter" }
Output for 5.4.34 - 5.4.45
array(57) { [0]=> string(8) "stdClass" [4]=> string(8) "DateTime" [8]=> string(11) "LibXMLError" [13]=> string(13) "DOMStringList" [14]=> string(11) "DOMNameList" [15]=> string(21) "DOMImplementationList" [16]=> string(23) "DOMImplementationSource" [17]=> string(17) "DOMImplementation" [18]=> string(7) "DOMNode" [19]=> string(16) "DOMNameSpaceNode" [20]=> string(19) "DOMDocumentFragment" [21]=> string(11) "DOMDocument" [22]=> string(11) "DOMNodeList" [23]=> string(15) "DOMNamedNodeMap" [24]=> string(16) "DOMCharacterData" [27]=> string(7) "DOMText" [28]=> string(10) "DOMComment" [29]=> string(11) "DOMTypeinfo" [30]=> string(18) "DOMUserDataHandler" [31]=> string(11) "DOMDomError" [32]=> string(15) "DOMErrorHandler" [33]=> string(10) "DOMLocator" [34]=> string(16) "DOMConfiguration" [36]=> string(15) "DOMDocumentType" [37]=> string(11) "DOMNotation" [38]=> string(9) "DOMEntity" [41]=> string(15) "DOMStringExtend" [43]=> string(5) "finfo" [44]=> string(8) "Collator" [45]=> string(15) "NumberFormatter" [46]=> string(10) "Normalizer" [47]=> string(6) "Locale" [48]=> string(16) "MessageFormatter" [49]=> string(17) "IntlDateFormatter" [50]=> string(14) "ResourceBundle" [52]=> string(12) "Spoofchecker" [77]=> string(14) "AppendIterator" [81]=> string(13) "EmptyIterator" [83]=> string(11) "ArrayObject" [84]=> string(13) "ArrayIterator" [85]=> string(22) "RecursiveArrayIterator" [93]=> string(19) "SplDoublyLinkedList" [94]=> string(8) "SplQueue" [95]=> string(8) "SplStack" [97]=> string(10) "SplMinHeap" [98]=> string(10) "SplMaxHeap" [99]=> string(16) "SplPriorityQueue" [100]=> string(13) "SplFixedArray" [101]=> string(16) "SplObjectStorage" [102]=> string(16) "MultipleIterator" [107]=> string(14) "SessionHandler" [109]=> string(10) "Reflection" [119]=> string(22) "__PHP_Incomplete_Class" [120]=> string(15) "php_user_filter" [121]=> string(9) "Directory" [128]=> string(9) "XMLReader" [129]=> string(9) "XMLWriter" }
Output for 5.4.0 - 5.4.32
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>SoapServer::SoapServer(): Invalid parameters</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/GgYLj on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/GgYLj on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/GgYLj on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/GgYLj on line 5
Process exited with code 255.