3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "<script>"; echo json_encode('"</script><script>alert("XSS");</script>"', JSON_UNESCAPE_SLASH); echo "</script>";
based on LDraS
Output for 7.2.0
<script> Warning: Use of undefined constant JSON_UNESCAPE_SLASH - assumed 'JSON_UNESCAPE_SLASH' (this will throw an Error in a future version of PHP) in /in/TKmg6 on line 5 Warning: json_encode() expects parameter 2 to be integer, string given in /in/TKmg6 on line 5 </script>
Output for 7.0.0 - 7.1.10
<script> Notice: Use of undefined constant JSON_UNESCAPE_SLASH - assumed 'JSON_UNESCAPE_SLASH' in /in/TKmg6 on line 5 Warning: json_encode() expects parameter 2 to be integer, string given in /in/TKmg6 on line 5 </script>
Output for 5.5.0 - 5.6.28
<script> Notice: Use of undefined constant JSON_UNESCAPE_SLASH - assumed 'JSON_UNESCAPE_SLASH' in /in/TKmg6 on line 5 Warning: json_encode() expects parameter 2 to be long, string given in /in/TKmg6 on line 5 </script>