This should work (as far as I can tell) But yields the following error.
Parse error: parse error, unexpected T_CHARACTER, expecting T_STRING or
T_VARIABLE or T_NUM_STRING
Any help is appreciated!

function HTMLfromNickName ( $player ) {
//example input "^2pla^3yer"
  $color=array(
      "1"=>"#FF0000",
      "2"=>"#00FF00",
      "3"=>"#F0FF0F",
      "4"=>"#0000FF",
      "5"=>"#00FFFF",
      "6"=>"#FF00FF",
      "7"=>"#FFFFFF",
      "8"=>"ltbrown",
      "9"=>"#0F00F0",
      "0"=>"#E7E7E7"
      );
  $pattern = "/\^(\d)/";
  $replacement = "$color[$1]";
  $player = preg_replace($pattern, $replacement, $player);
  return $player;
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to