3v4l.org

run code in 500+ PHP versions simultaneously
<?php class UrlConcrete { /** * @param DateTimeInterface|DateTime|null $lastmod * * @return UrlConcrete */ public function setLastmod($lastmod = null) { if (!($lastmod instanceof \DateTimeInterface || $lastmod instanceof \DateTime)) { $typePassed = is_object($lastmod) ? \get_class($lastmod) : \gettype($lastmod); if (\PHP_MAJOR_VERSION >= 7) { throw new \TypeError('Argument 1 passed to ' . __METHOD__ . "() must be an instance of DateTimeInterface, '$typePassed' given"); } else { \trigger_error('Argument 1 passed to ' . __METHOD__ . "() must be an instance of DateTime, '$typePassed' given", E_USER_ERROR); return $this; } } $this->lastmod = $lastmod; return $this; } } $x = new UrlConcrete(); $x->setLastmod(new \DateTime()); $x->setLastmod(new stdclass());
Output for 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Deprecated: Creation of dynamic property UrlConcrete::$lastmod is deprecated in /in/NHDnA on line 24 Fatal error: Uncaught TypeError: Argument 1 passed to UrlConcrete::setLastmod() must be an instance of DateTimeInterface, 'stdClass' given in /in/NHDnA:16 Stack trace: #0 /in/NHDnA(32): UrlConcrete->setLastmod(Object(stdClass)) #1 {main} thrown in /in/NHDnA on line 16
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.30, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34
Fatal error: Uncaught TypeError: Argument 1 passed to UrlConcrete::setLastmod() must be an instance of DateTimeInterface, 'stdClass' given in /in/NHDnA:16 Stack trace: #0 /in/NHDnA(32): UrlConcrete->setLastmod(Object(stdClass)) #1 {main} thrown in /in/NHDnA on line 16
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Argument 1 passed to UrlConcrete::setLastmod() must be an instance of DateTime, 'stdClass' given in /in/NHDnA on line 18
Process exited with code 255.
Output for 5.2.7 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 13 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 13 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 15 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 16 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 18 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 31 Fatal error: Argument 1 passed to UrlConcrete::setLastmod() must be an instance of DateTime, 'stdClass' given in /in/NHDnA on line 18
Process exited with code 255.
Output for 5.2.0 - 5.2.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 13 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 13 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 15 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 16 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 18 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 31 Notice: Use of undefined constant PHP_MAJOR_VERSION - assumed 'PHP_MAJOR_VERSION' in /in/NHDnA on line 15 Fatal error: Argument 1 passed to UrlConcrete::setLastmod() must be an instance of DateTime, 'stdClass' given in /in/NHDnA on line 18
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 13 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 13 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 15 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 16 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 18 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/NHDnA on line 31 Fatal error: Class 'DateTime' not found in /in/NHDnA on line 31
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/NHDnA on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/NHDnA on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/NHDnA on line 10
Process exited with code 255.

preferences:
97.42 ms | 2654 KiB | 4 Q