What PHP function can be used to determine if a character from a pool appears twice in a string?

To determine if a character from a pool appears twice in a string, you can use the PHP function `substr_count()`. This function counts the number of occurrences of a substring within a string. By iterating over the characters in the pool and checking if the count is greater than 1, you can identify if any character appears more than once in the string.

function isCharacterRepeated($string, $pool) {
    foreach(str_split($pool) as $char) {
        if(substr_count($string, $char) > 1) {
            return true;
        }
    }
    return false;
}

// Example usage
$string = "hello";
$pool = "elo";
if(isCharacterRepeated($string, $pool)) {
    echo "At least one character from the pool appears twice in the string.";
} else {
    echo "No character from the pool appears twice in the string.";
}