<?php
$value = str_repeat('a.', 126) . 'aaaa'; // 256 characters, max allowed is 253, trailing dot ignored
$result = idn_to_ascii($value, 0, INTL_IDNA_VARIANT_UTS46, $idnaInfo);
var_dump($result);
var_dump($idnaInfo);
// $idnaInfo['errors'] should be equal to 4, it is value of IDNA_ERROR_DOMAIN_NAME_TOO_LONG
Fatal error: Uncaught Error: Call to undefined function idn_to_ascii() in /in/eX6aA:4
Stack trace:
#0 {main}
thrown in /in/eX6aA on line 4
Process exited with code 255.