JS - Using PHP inside js code

0 votes
294 views
added Dec 17, 2020 in Javascript by lcjr First Warrant Officer (11,990 points)
<html>
    <body>
    <?php
        $myScript = "Hey World!";
    ?>
    <script type="text/javascript">
        document.write("<?php echo $myScript ?>");
    </script>
    <?php
    //....php code...
    ?>
    </body>
</html>

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...