What are the advantages and disadvantages of using http_build_query() to build query strings in PHP?

When building query strings in PHP, using the `http_build_query()` function can simplify the process by automatically encoding the data in the correct format. This function takes an array of data and constructs a URL-encoded query string, making it easier to pass parameters in URLs or form submissions. However, one disadvantage is that it may not handle nested arrays or complex data structures as effectively, requiring additional manipulation before using the function.

$data = array(
    'name' => 'John Doe',
    'age' => 30,
    'city' => 'New York'
);

$queryString = http_build_query($data);

echo $queryString;