3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $message = 'This is a string using the terms? Wait here\'s one abukuma kai abukuma-kai abukuma abukuma'; $search = array( 'abukuma kai', 'abukuma' ); // Massage the message $message = preg_replace( array_map( function($s) { $s = preg_quote($s) $s = str_replace(' ', '[ -_]', $s); return '/' . $s . '/'; ), array_map( function ($s) { return '%%' . $s . '%%' }, array_keys($search) ), $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://kancolle.wikia.com/wiki/Abukuma#Upgrade" class="screenshot" rel="ship/Abukuma_Kai.png" style="color:#0073e6; font-weight:bold; border-bottom: 1px #0073e6 dashed;"><p id="yosup">Abukuma Kai</p></a>', '<a href="http://kancolle.wikia.com/wiki/Abukuma#Basic" class="screenshot" rel="ship/Abukuma.png" style="color:#0073e6; font-weight:bold; border-bottom: 1px #0073e6 dashed;">Abukuma</a>' ); $message = str_replace( array_map(function($s) { return '%%' . $s . '%%'; }, array_keys($replacements)), $replacements, $message );
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected '$s' (T_VARIABLE) in /in/3e0PL on line 15
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/3e0PL on line 15
Process exited with code 255.