3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_emoji($str){ function empic($h){ $p=dechex(str_replace(array('&#',';'),'',$h)); return '<img src="_POST[face]'.$p.'.png" alt="'.$h.'" class="smiley" />'; }; $str=preg_replace('#(\&\#[0-9]{6}\;)#ie','empic("\\1")',$str); return $str; }; $com_print=str_emoji('aaa&#128027;&#128013;bbb'); var_dump($com_print);
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /in/CRnYb on line 8 NULL
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /in/CRnYb on line 8 string(136) "aaa<img src="_POST[face]1f41b.png" alt="&#128027;" class="smiley" /><img src="_POST[face]1f40d.png" alt="&#128013;" class="smiley" />bbb"
Output for 5.4.0 - 5.4.45
string(136) "aaa<img src="_POST[face]1f41b.png" alt="&#128027;" class="smiley" /><img src="_POST[face]1f40d.png" alt="&#128013;" class="smiley" />bbb"

preferences:
261.53 ms | 402 KiB | 376 Q