3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $emoticons = array( // ... 'cry' => array( 'image' => '<img class="smiley" src="/image/emoticon/cry.gif" />', 'emoticons' => array(":'(", ";'(", ":'-(", ";'-(") ), ); function replaceEmoticons($input) { global $emoticons; $output = $input; foreach ($emoticons as $emo_group_name => $emo_group) { $regex_emo_part = array(); foreach ($emo_group['emoticons'] as $emoticon) { $regex_emo_part[] = preg_quote($emoticon, '#'); } $regex_emo_part = implode('|', $regex_emo_part); $regex = '#(?!<\w)(' . $regex_emo_part .')(?!\w)#'; $output = preg_replace($regex, $emo_group['image'], $output); } return $output; } var_dump(replaceEmoticons(":'(;'(:'-(;'-(");
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.4.34
Parse error: syntax error, unexpected ';' in /in/0KNGL on line 32
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected ';' in /in/0KNGL on line 32
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/0KNGL on line 32
Process exited with code 255.