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 git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property Foo::$current is deprecated in /in/OWmoG on line 16 bool(true)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
40.5 ms | 401 KiB | 8 Q