This question already has an answer here:
I have a file written in PHP. I would like to have inline if/else statements of JavaScript in PHP. Is it possible? An example is given below:
<?php
echo "<script type=\"text/javascript\">
function myFunction(a, b) {
if(a>b)
return true;
else
return false;
}
if(myFunction(3,2)) { ";
$x = '/index';
echo "} else { ";
$x = '/index2';
echo "}";
echo "</script>";
?>
Aucun commentaire:
Enregistrer un commentaire