<?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;
preferences:
32.38 ms | 402 KiB | 5 Q