3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dec = json_decode('{"a":"A\u2028B"}'); print_r(json_encode($dec)); $json = json_encode($dec); $json = strtr( $json, array( "\xE2\x80\xA8" => '', // \u2028 "\xE2\x80\xA9" => '', // \u2029 ) ); $test = json_encode($dec, JSON_UNESCAPED_UNICODE); echo strlen($json), ' ', strlen($test);

preferences:
47.37 ms | 402 KiB | 5 Q