3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<u>\\n\\\\*HYPERLINK \\"http://www.youtube.com/watch?v=A0VUsoeT9aM\\"A Youtube Video</u>'; $pattern = '/http[?.:=\w\d\\/]*/'; $namePattern = '/(?:")([\s\w]*)</'; preg_match($pattern, $string, $matches); preg_match($namePattern, $string, $nameMatches); print "original output:\n"; var_dump($matches[0]); var_dump($nameMatches[1]); print "\n"; $newString = 'Blablabla Beginning Text <u>\\n\\\\*HYPERLINK \\"http://www.youtube.com/watch?v=A0VUsoeT9aM\\"1.A Youtube Video</u> blablabla Text Middle <u>\\n\\\\*HYPERLINK \\"http://www.youtube.com/watch?v=A0VUsoeT9aM\\"2. A Youtube Video</u> blabla Text after'; $newpattern = '/(http[?.:=\w\d\\/]*)\\\\"([\s\w]*)/'; print "does the new pattern work?\n"; preg_match($newpattern, $newString, $allMatches); var_dump($allMatches); print "yep.\n"; $newReplace = '<a href="\\1">\\2</a>'; var_dump( preg_replace($newpattern, $newReplace, $newString) );
Output for git.master, git.master_jit, rfc.property-hooks
original output: string(42) "http://www.youtube.com/watch?v=A0VUsoeT9aM" string(15) "A Youtube Video" does the new pattern work? array(3) { [0]=> string(45) "http://www.youtube.com/watch?v=A0VUsoeT9aM\"1" [1]=> string(42) "http://www.youtube.com/watch?v=A0VUsoeT9aM" [2]=> string(1) "1" } yep. string(263) "Blablabla Beginning Text <u>\n\\*HYPERLINK \"<a href="http://www.youtube.com/watch?v=A0VUsoeT9aM">1</a>.A Youtube Video</u> blablabla Text Middle <u>\n\\*HYPERLINK \"<a href="http://www.youtube.com/watch?v=A0VUsoeT9aM">2</a>. A Youtube Video</u> blabla Text after"

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:
38.34 ms | 402 KiB | 8 Q