Use PHP's built in http_build_query instead of rolling your own.

Useful package by the way :-)