3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class test { const max =5; protected $_c = 0; public function tst() { $this->_c = ($this->_c + 1) % self::max; if ($this->_c === 0) echo '!'.PHP_EOL; } } $t = new test(); for ($i=0; $i<16; $i++) { echo $i; $t->tst(); }
Output for 5.0.2 - 7.1.0
01234! 56789! 1011121314! 15
Output for 5.0.0 - 5.0.1
01234 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/KQBoA on line 11 !PHP_EOL56789 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/KQBoA on line 11 !PHP_EOL1011121314 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/KQBoA on line 11 !PHP_EOL15
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/KQBoA on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/KQBoA on line 4
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/KQBoA on line 4
Process exited with code 255.