Use string concat instead of implode in parser

This commit is contained in:
Alf Magne Kalleland
2013-02-03 20:48:27 +01:00
parent d400a74c7d
commit 41a764d70f

View File

@@ -1353,16 +1353,13 @@ class FenParser0x88
function setNewFen() function setNewFen()
{ {
$board = $this->cache['board']; $board = $this->cache['board'];
$fen = ''; $fen = '';
$emptyCounter = 0; $emptyCounter = 0;
for ($rank = 7; $rank >= 0; $rank--) { for ($rank = 7; $rank >= 0; $rank--) {
for ($file = 0; $file < 8; $file++) { for ($file = 0; $file < 8; $file++) {
$index = ($rank * 8) + $file; $index = ($rank * 8) + $file;
if ($board[Board0x88Config::$numericMapping[$index]]) { if ($board[Board0x88Config::$numericMapping[$index]]) {
if ($emptyCounter) { if ($emptyCounter) {
$fen .= $emptyCounter; $fen .= $emptyCounter;
@@ -1385,8 +1382,7 @@ class FenParser0x88
if ($emptyCounter) { if ($emptyCounter) {
$fen .= $emptyCounter; $fen .= $emptyCounter;
} }
return $fen . " ". $this->getColorCode(). " ". $this->getCastle()." ". $this->fenParts['enPassant']." ". $this->getHalfMoves()." ". $this->getFullMoves();
return implode(" ", array($fen, $this->getColorCode(), $this->getCastle(), $this->fenParts['enPassant'], $this->getHalfMoves(), $this->getFullMoves()));
} }
} }