3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Define the PHP value in your code $js_user_acc = true; ?> <html> <head> <title>whatever</title> <!-- in the HTML output, set it as a Javascript literal value --> <script> var MyNamespace = { user_acc: <?= json_encode($js_user_acc) ?>, }; </script> </head> <body> <div>foo</div> </body> </html>

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
171.7 ms | 2232 KiB | 11 Q