0)) // if the color code was found beyond the 0 mark, then { $new_string .= substr($source_string, $new_strPos, (($strPos-1) - $new_strPos)); // read in the first bit $chars += (($strPos-1) - $new_strPos); } $new_strPos = $strPos + 7; // set the new length to get $strPos = strpos($source_string, "0x", $strPos); // get the next color code's position if ($strPos == false) // if there is none { $strPos = strlen($source_string); // make the strpos the length of the entire source string // put the current color and the extra into $new_string $new_string .= ''.substr($source_string, $new_strPos, ($strPos - $new_strPos)).''; $chars += ($strPos - $new_strPos); $strPos = false; //now turn this back to it's original value, false } else // if there is another { // put the current color and the extra into $new_string $new_string .= ''.substr($source_string, $new_strPos, ($strPos - $new_strPos)).''; $chars += ($strPos - $new_strPos); } $firstTime = false; } else // if this is not the first time, most of the things that had taken place will also take place here. No confusion necessary. { $colorCode = substr($source_string, $strPos, 8); $colorCode = str_replace("0x", "#", $colorCode); if (($new_strPos == 0) && ($strPos > 0)) { $new_string .= substr($source_string, $new_strPos, ($strPos - $new_strPos)); $chars += ($strPos - $new_strPos); } $new_strPos = $strPos + 8; $strPos = strpos($source_string, "0x", $strPos+1); if ($strPos == false) { $strPos = strlen($source_string); $new_string .= ''.substr($source_string, $new_strPos, ($strPos - $new_strPos)).''; $chars += ($strPos - $new_strPos); $strPos = false; } else { $new_string .= ''.substr($source_string, $new_strPos, ($strPos - $new_strPos)).''; $chars += ($strPos - $new_strPos); } } } // now write the new string to the browser page ?>

Enter your color coded arma string into the box and click "Convert"