3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //Source: https://bugs.php.net/bug.php?id=63898 $key = "Foo " . chr(163); $array = array($key => ""); print_r($array); $json = json_encode($array); echo $json."\n"; print_r(json_decode($json)); $x = 'Audio Pass: Get live NFL game audio while you’re on the road with Audio Pass.'; var_dump(htmlentities($x)); var_dump(htmlentities($x, ENT_COMPAT | ENT_SUBSTITUTE, 'ISO-8859-1'));
based on OeMgg
Output for 5.5.0 - 7.1.0
Array ( [Foo �] => ) string(83) "Audio Pass: Get live NFL game audio while you&rsquo;re on the road with Audio Pass." string(85) "Audio Pass: Get live NFL game audio while you&acirc;��re on the road with Audio Pass."
Output for 5.4.0 - 5.4.45
Array ( [Foo �] => ) {null:""} string(83) "Audio Pass: Get live NFL game audio while you&rsquo;re on the road with Audio Pass." string(85) "Audio Pass: Get live NFL game audio while you&acirc;��re on the road with Audio Pass."
Output for 5.2.7 - 5.3.13, 5.3.15 - 5.3.29
Array ( [Foo �] => ) {null:""} string(85) "Audio Pass: Get live NFL game audio while you&acirc;��re on the road with Audio Pass." Notice: Use of undefined constant ENT_SUBSTITUTE - assumed 'ENT_SUBSTITUTE' in /in/MIR5c on line 18 string(85) "Audio Pass: Get live NFL game audio while you&acirc;��re on the road with Audio Pass."
Output for 5.3.14
Array ( [Foo �] => ) Warning: json_encode(): Invalid UTF-8 sequence in argument in /in/MIR5c on line 9 string(85) "Audio Pass: Get live NFL game audio while you&acirc;��re on the road with Audio Pass." Notice: Use of undefined constant ENT_SUBSTITUTE - assumed 'ENT_SUBSTITUTE' in /in/MIR5c on line 18 string(85) "Audio Pass: Get live NFL game audio while you&acirc;��re on the road with Audio Pass."
Output for 5.2.0 - 5.2.6
Array ( [Foo �] => ) {"Foo ":""} stdClass Object ( [Foo ] => ) string(85) "Audio Pass: Get live NFL game audio while you&acirc;��re on the road with Audio Pass." Notice: Use of undefined constant ENT_SUBSTITUTE - assumed 'ENT_SUBSTITUTE' in /in/MIR5c on line 18 string(85) "Audio Pass: Get live NFL game audio while you&acirc;��re on the road with Audio Pass."
Output for 5.0.0 - 5.1.6
Array ( [Foo �] => ) Fatal error: Call to undefined function json_encode() in /in/MIR5c on line 9
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Array ( [Foo �] => ) Fatal error: Call to undefined function: json_encode() in /in/MIR5c on line 9
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Array ( [Foo �] => ) Fatal error: Call to undefined function: json_encode() in /in/MIR5c on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Array ( [Foo �] => ) Fatal error: Call to undefined function: json_encode() in /in/MIR5c on line 9