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.'; $loops = 0; $callback = function($match) use(&$loops) { return ++$loops <= 3 ? $match[0] : ' '; }; echo "BEFORE : ", $message, "\n"; echo "AFTER : ", preg_replace_callback('~\h*#[a-z]+\h*~i', $callback, $message), "\n"; echo "LOOPS : ", $loops, "\n";
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.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/2G0cI on line 5
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/2G0cI on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/2G0cI on line 5
Process exited with code 255.