3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $message = 'What will happen to the #globe if there is more #sunlight more #moonlight but less overall #light. Ah! Funny little #joke. Goodbye fellas!!! #Morning Jokes #For No one.'; $GLOBALS['_loops'] = 0; echo "BEFORE : ", $message, "\n"; echo "AFTER : ", preg_replace_callback('~\h*#[a-z]+\h*~i', function($match) { return ++$GLOBALS['_loops'] <= 3 ? $match[0] : ' '; }, $message), "\n"; echo "LOOPS : ", $GLOBALS['_loops'], "\n";
Output for 5.3.0 - 7.1.0
BEFORE : What will happen to the #globe if there is more #sunlight more #moonlight but less overall #light. Ah! Funny little #joke. Goodbye fellas!!! #Morning Jokes #For No one. AFTER : What will happen to the #globe if there is more #sunlight more #moonlight but less overall . Ah! Funny little . Goodbye fellas!!! Jokes No one. LOOPS : 7
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/tSpIm on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/tSpIm on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/tSpIm on line 6
Process exited with code 255.