TicTacToe basic algorithm in PHP