How can PHP scripts be modified to properly handle UTF-8 encoded data for accurate string manipulation and comparison?

When working with UTF-8 encoded data in PHP scripts, it is important to ensure that the strings are properly handled to avoid issues with string manipulation and comparison. To do this, it is recommended to set the internal encoding to UTF-8 using the `mb_internal_encoding()` function and use multibyte string functions from the `mbstring` extension for accurate operations on UTF-8 strings.

// Set internal encoding to UTF-8
mb_internal_encoding('UTF-8');

// Example of using multibyte string functions for accurate manipulation
$string1 = 'こんにちは'; // Japanese word for "hello"
$string2 = 'こんばんは'; // Japanese word for "good evening"

// Compare two UTF-8 strings
if(mb_strtolower($string1) === mb_strtolower($string2)) {
    echo 'The strings are equal.';
} else {
    echo 'The strings are not equal.';
}