3v4l.org

run code in 300+ PHP versions simultaneously
<?php $chunk = 'This is a very large text line I have ever seen in my life and I love it.'; $searchfor = 'I have'; $pattern = preg_quote($searchfor, '/'); $pattern = "/^.*?(.{1,10}$pattern.{1,10}).*$/m"; if(preg_match_all($pattern, $chunk, $matches)){ echo "Found matches:\n"; echo implode("\n", $matches[1]) . "\n"; } $searchfor = 'a very'; $pattern = preg_quote($searchfor, '/'); $pattern = "/^.*?(.{1,10}$pattern.{1,10}).*$/m"; if(preg_match_all($pattern, $chunk, $matches)){ echo "Found matches:\n"; echo implode("\n", $matches[1]) . "\n"; } $searchfor = 'and I'; $pattern = preg_quote($searchfor, '/'); $pattern = "/^.*?(.{1,10}$pattern.{1,10}).*$/m"; if(preg_match_all($pattern, $chunk, $matches)){ echo "Found matches:\n"; echo implode("\n", $matches[1]) . "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Found matches: text line I have ever seen Found matches: This is a very large tex Found matches: n my life and I love it.

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