3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $find = array( '/\^0(.*?)\^/', '/\^1(.*?)\^/', '/\^2(.*?)\^/', '/\^3(.*?)\^/', '/\^4(.*?)\^/', '/\^5(.*?)\^/', '/\^6(.*?)\^/', '/\^7(.*?)\^/', '/\^8(.*?)\^/', '/\^9(.*?)\^/', ); $replace = array( '<font color="#000000">$1</font>^', '<font color="#F65A5A">$1</font>^', '<font color="#00F100">$1</font>^', '<font color="#EFEE04">$1</font>^', '<font color="#0F04E8">$1</font>^', '<font color="#04E8E7">$1</font>^', '<font color="#F75AF6">$1</font>^', '<font color="#FFFFFF">$1</font>^', '<font color="#7E7E7E">$1</font>^', '<font color="#6E3C3C">$1</font>^', ); // Just a Random Test String $aDemoString = "^3THE^7::^5MODERN^2WARFARE^7::^3Server^7"; $namefix = preg_replace($find, $replace, $aDemoString); echo $namefix;
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<font color="#EFEE04">THE</font><font color="#FFFFFF">::<font color="#04E8E7">MODERN<font color="#00F100">WARFARE</font></font></font>^7::<font color="#EFEE04">Server</font>^7