3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function isCorrect($string) { $string{strlen($string)-1}; } $string = '()'; var_dump($string{strlen($string)}); //assert(isCorrect('') === true); //assert(isCorrect('()') === true); //assert(isCorrect('{()}') === true); //assert(isCorrect('{()}{}') === true); //assert(isCorrect('(())') === true); //assert(isCorrect('{({({({()})})})}') === true); //assert(isCorrect('{(})') === false);
based on Ns8pB
Output for 5.2.10 - 5.6.21, 7.0.0 - 7.1.0
Notice: Uninitialized string offset: 2 in /in/43l4J on line 6 string(0) ""
Output for hhvm-3.12.0
string(0) ""
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 5.0.5, 5.1.1 - 5.2.9
Notice: Uninitialized string offset: 2 in /in/43l4J on line 6 string(0) ""
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/43l4J on line 13
Process exited with code 255.