3v4l.org

run code in 300+ PHP versions simultaneously
<?php $message = 'choukai kai hey this matches too 423-2123'; $search = array('surfing', 'joke and stuff', 'smile and etc', '3-2', 'choukai kai', 'choukai'); // Massage the message $message = preg_replace( '/(' . implode('|', array_map('preg_quote', $search)) . ')/i', '%%$1%%', $message ); $replacements = array( // here all replaces | each in a new line - watch the syntax // all html possible, but no single quotation mark! '<a href="http://en.wikipedia.org/wiki/Surfing" style="color:darkred;font-weight:bold;">surfing</a>', '<a href="http://en.wikipedia.org/wiki/Joke" style="color:darkred;font-weight:bold;">joke</a>', '<a href="http://en.wikipedia.org/wiki/Smiling" style="color:darkred;font-weight:bold;">Smile</a>', '<a class="screenshot" rel="3-2_Map.jpg">3-2</a>', '<a href="http://en.wikipedia.org/wiki/Joke" style="color:darkred;font-weight:bold;">Choukai Kai</a>', '<a href="http://en.wikipedia.org/wiki/Smiling" style="color:darkred;font-weight:bold;">Choukai</a>' ); $message = str_replace( array_map(function($s) { return '%%' . $s . '%%'; }, $search), $replacements, $message ); var_dump($message);
Output for git.master, git.master_jit, rfc.property-hooks
string(173) "<a href="http://en.wikipedia.org/wiki/Joke" style="color:darkred;font-weight:bold;">Choukai Kai</a> hey this matches too 42<a class="screenshot" rel="3-2_Map.jpg">3-2</a>123"

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:
42.58 ms | 401 KiB | 8 Q