Are there specific functions or methods in PHP that can be used to handle special characters when building an array from database results?

When building an array from database results in PHP, it is important to handle special characters properly to avoid any encoding issues. One way to handle special characters is to use the `utf8_encode()` function to encode the string into UTF-8 format before adding it to the array. This ensures that special characters are properly encoded and displayed correctly.

// Sample code to build an array from database results handling special characters
$results = array();

// Assuming $db_results is the array fetched from the database
foreach ($db_results as $row) {
    $encoded_row = array_map('utf8_encode', $row);
    $results[] = $encoded_row;
}

print_r($results);