show html file code in php code example
Example 1: how to write php in script file
<script type="text/javascript">
var phpVars = {
<?php
foreach ($phpToJsVars as $key => $value) {
echo ' ' . $key . ': ' . '"' . $value . '",' . "\n";
}
?>
};
</script>
Example 2: inline php in html
<body>
Hello, today is <?php echo date('l, F jS, Y'); ?>.
</body>