3v4l.org

run code in 300+ PHP versions simultaneously
<?php $example1 = 'Blah blah blah. THIS SENTENCE SHOULD BE SELECTED [bbcode]'; $example2 = 'THIS SENTENCE SHOULD BE SELECTED [bbcode]'; $example3 = 'A trick sentence. And another. THIS SENTENCE SHOULD BE SELECTED [bbcode]'; function extractSentence($string) { $before = substr($string, 0, strpos($string, '[bbcode]')); return trim(substr($before, strrpos($before, '.')), "\n ."); } echo extractSentence($example1); echo "\n"; echo extractSentence($example2); echo "\n"; echo extractSentence($example3); echo "\n";
Output for git.master, git.master_jit, rfc.property-hooks
THIS SENTENCE SHOULD BE SELECTED THIS SENTENCE SHOULD BE SELECTED THIS SENTENCE SHOULD BE SELECTED

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