3v4l.org

run code in 300+ PHP versions simultaneously
<?php function preserveAmpersandEscapeInOptionTagForFomanticUiDropdownWithPreserveHtmlFalse($v) { return str_replace('&amp;', '&amp;amp;', $v); } $in = 'A & B &amp;'; // example of text to preserve $in .= ' ' . preserveAmpersandEscapeInOptionTagForFomanticUiDropdownWithPreserveHtmlFalse($in); // example of escaping the text to preserve it 1:1 echo $in . "\n"; $str = preg_replace('~&(?!\w+;)~', '&amp;', $in); // done by browser when parsing/normalizing HTML echo $str . "\n"; $str = str_replace('&amp;', '&', $in); // done by https://github.com/fomantic/Fomantic-UI/pull/3224/commits/0bc8f67dcb echo $str . "\n";
Output for git.master, git.master_jit
A & B &amp; A & B &amp;amp; A &amp; B &amp; A &amp; B &amp;amp; A & B & A & B &amp;

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