<?php
$process = "";
for ($i=1 ; $i<10 ; $i++) {
$process .= "addCell(\"$i\");\n"; // create a JavaScrip program
}
?>
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Write JavaScript process using php</title>
</head>
<body>
<div id="main"></div>
<script>
function addCell(name)
{
document.getElementById("main").innerHTML += name + "|";
}
<?php
echo $process;
?>
</script>
</body>
</html>
<!--
*** Page content will be
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Write JavaScript process using php</title>
</head>
<body>
<div id="main"></div>
<script>
function addCell(name)
{
document.getElementById("main").innerHTML += name + "|";
}
// perform the JavaScript program written in PHP
addCell("1");
addCell("2");
addCell("3");
addCell("4");
addCell("5");
addCell("6");
addCell("7");
addCell("8");
addCell("9");
</script>
</body>
</html>
-->