3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function parse_emojis(string $string): string { preg_match_all('/(?<match>:.*:)/', $string, $matches, PREG_PATTERN_ORDER); $emojis = $matches['match']; foreach ($emojis as $emoji): $emoji_name = trim($emoji, ':'); foreach (EMOJIS as $key => $value): $names = $value[3]; foreach($names as $name): if ($name == $emoji_name): $string = str_replace($emoji, sprintf('\\u{%s}', $key), $string); break; endif; endforeach; endforeach; endforeach; console_log('$string', $string); return $string; }
based on MkdbQ
Output for hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.1
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ':', expecting '{' in /in/LeADO on line 3
Process exited with code 255.