1// The most basic method
2<?php
3echo '<script type="text/javascript">',
4 'someJsFunc();', // Or Whatever
5 '</script>';
6?>
7
8// However, if what you are trying to achieve requires more complexity,
9// You might be better off adding the V8JS module, see link below
1<script>
2 var phpadd= <?php echo add(1,2);?> //call the php add function
3 var phpmult= <?php echo mult(1,2);?> //call the php mult function
4 var phpdivide= <?php echo divide(1,2);?> //call the php divide function
5</script>
1<?php
2 if(your condition){
3 echo "<script> window.onload = function() {
4 yourJavascriptFunction(param1, param2);
5 }; </script>";
6?>