Are there any specific PHP functions or libraries that can be used for handling IDN (Internationalized Domain Names) instead of shell_exec?

When handling IDN (Internationalized Domain Names) in PHP, instead of using shell_exec to call external commands, it is recommended to use PHP's built-in functions or libraries for handling IDN conversions. One such library is the `idna_convert` library, which provides functions for converting between Unicode and ASCII representations of domain names.

// Using the idna_convert library to handle IDN conversions
require_once 'path/to/idna_convert.php';

$idn = new idna_convert();

// Convert Unicode domain name to ASCII
$ascii_domain = $idn->encode('example.com');

// Convert ASCII domain name to Unicode
$unicode_domain = $idn->decode('xn--example.com');