3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL & ~E_STRICT); class Foo { var $pos = 0; var $str; function Foo($str) { $this->__construct($str); } function __construct($str) { $this->str = $str; $this->current = $this->lookAhead(); } function isLineBreak() { if ("\r" !== $this->current && "\n" !== $this->current) { return false; } $char = $this->current; do { $brk = ("\n" === $char); $char = $this->lookAhead(); switch ($char) { case " ": return false; case "\n": if ($brk) { return true; } break; default: return $brk; } } while (true); } function lookAhead() { return mb_strcut($this->str, $this->pos++, 1); } } function crlf($str) { $foo = new Foo($str); return $foo->isLineBreak(); } var_dump(crlf("\r\n"));
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Deprecated: Creation of dynamic property Foo::$current is deprecated in /in/OWmoG on line 16 bool(true)
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 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.27
bool(true)
Output for 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Strict Standards: Redefining already defined constructor for class Foo in /in/OWmoG on line 13 bool(true)
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/OWmoG on line 7 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/OWmoG on line 8 Strict Standards: Redefining already defined constructor for class Foo in /in/OWmoG on line 13 bool(true)
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
Notice: Use of undefined constant E_STRICT - assumed 'E_STRICT' in /in/OWmoG on line 3 bool(true)

preferences:
215.84 ms | 401 KiB | 324 Q