A one-liner for creating string of HTML attributes (with quotes) from a simple array:
$attrString = str_replace("+", " ", str_replace("&", "\" ", str_replace("=", "=\"", http_build_query($attrArray)))) . "\"";
Example:
$attrArray = array("id" => "email",
"name" => "email",
"type" => "email",
"class" => "active large");
echo str_replace("+", " ", str_replace("&", "\" ", str_replace("=", "=\"", http_build_query($attrArray)))) . "\"";
// Output:
// id="email" name="email" type="email" class="active large"