3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php ini_set("intl.use_exceptions", true); try{ var_dump(idn_to_ascii( "", IDNA_USE_STD3_RULES | IDNA_NONTRANSITIONAL_TO_UNICODE | IDNA_CHECK_CONTEXTJ, INTL_IDNA_VARIANT_UTS46, $info )); }catch(\Throwable $e){ } var_dump($info); $errors = [ "IDNA_ERROR_EMPTY_LABEL", "IDNA_ERROR_LABEL_TOO_LONG", "IDNA_ERROR_DOMAIN_NAME_TOO_LONG", "IDNA_ERROR_LEADING_HYPHEN", "IDNA_ERROR_TRAILING_HYPHEN", "IDNA_ERROR_HYPHEN_3_4", "IDNA_ERROR_LEADING_COMBINING_MARK", "IDNA_ERROR_DISALLOWED", "IDNA_ERROR_PUNYCODE", "IDNA_ERROR_LABEL_HAS_DOT", "IDNA_ERROR_INVALID_ACE_LABEL", "IDNA_ERROR_BIDI", "IDNA_ERROR_CONTEXTJ" ]; foreach($errors as $errorReadable){ $error = constant($errorReadable); if($info['errors'] & $error){ echo $errorReadable . "\n"; } }
based on VOIWI
Output for 7.0.0 - 7.0.4, 7.0.6 - 7.2.0
NULL
Output for 7.0.5
Notice: Undefined variable: info in /in/BPeIO on line 15 NULL Warning: constant(): Couldn't find constant IDNA_ERROR_EMPTY_LABEL in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_LABEL_TOO_LONG in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_DOMAIN_NAME_TOO_LONG in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_LEADING_HYPHEN in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_TRAILING_HYPHEN in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_HYPHEN_3_4 in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_LEADING_COMBINING_MARK in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_DISALLOWED in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_PUNYCODE in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_LABEL_HAS_DOT in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_INVALID_ACE_LABEL in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_BIDI in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36 Warning: constant(): Couldn't find constant IDNA_ERROR_CONTEXTJ in /in/BPeIO on line 35 Notice: Undefined variable: info in /in/BPeIO on line 36
Output for 5.5.24 - 5.5.28, 5.5.31 - 5.5.33, 5.5.35 - 5.6.12, 5.6.16 - 5.6.19, 5.6.21 - 5.6.28
Fatal error: Uncaught exception 'IntlException' with message 'idn_to_ascii: empty domain name' in /in/BPeIO:10 Stack trace: #0 /in/BPeIO(10): idn_to_ascii('', 42, 1, NULL) #1 {main} thrown in /in/BPeIO on line 10
Process exited with code 255.
Output for 5.5.29 - 5.5.30, 5.5.34, 5.6.13 - 5.6.15, 5.6.20
Fatal error: Call to undefined function idn_to_ascii() in /in/BPeIO on line 5
Process exited with code 255.
Output for 5.4.11 - 5.4.45
bool(false) NULL
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/BPeIO on line 17
Process exited with code 255.