3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sanitize($html) { return htmlspecialchars($html); } function sanitize_and_highlight_search_result($data, $query){ $sanitized = sanitize($data); $query = sanitize($query); return str_replace( $query, '<span class="highlight">' . $query . '</span>', $sanitized ); } echo sanitize_and_highlight_search_result("You & me", "&am"); // Shouldn't be found echo "\n"; echo sanitize_and_highlight_search_result("You & me", "&"); // Should be found and highlighted
Output for rfc.property-hooks, git.master, git.master_jit
You &amp; me You <span class="highlight">&amp;</span> me

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:
98.46 ms | 2039 KiB | 4 Q