3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_after($needle, $haystack, $removeNeedle = false) { $needle = preg_quote($needle) . ($removeNeedle ? '' : '\K'); return preg_replace("#.*\K$needle.*#s", '', $haystack); } var_dump(remove_after("cheese", "The cheese is good and the cheese is yummy")); var_dump(remove_after("cheese", "The cheese is good and the cheese is yummy", true));
Output for git.master_jit, git.master
string(33) "The cheese is good and the cheese" string(27) "The cheese is good and the "

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:
45.77 ms | 405 KiB | 5 Q