This should be a code that will take out a piece from $playername and give some value to $personality however it seems to be acting very strange:
First case: $playername is "filled" with:
"The Great Mr. Werner" and it works just fine and $personality is "General".
Second case: $playername is "filled" with:
"Sir ildrid the Rogue" and it doesn´t work. It can´t match "Rogue" I have trimed etc but no way in hell it will match. Is there something wrong with my code.
Comments suggestions, please.
Thanks.
The code:
if (preg_match('/Great(.*)./i', $playername, $match)) {
$temp = split (" ", $match[0]);
if ($temp[0] == "Great") { $personality = "General"; }}
if (preg_match('/Rogue (.*)./i', $playername, $match)) {
$temp = split (" ", $match[0]);
if ($temp[0] == "Rogue") { $personality = "Rogue"; }}