You can only do as the most used way, via parameter
hello.js
function jst(alertMe)
{
alert( alertMe );
}
index.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jsFileTest</title>
<script type="text/javascript" src="hello.js"></script>
<script type="text/javascript">
var alertMe = <?php echo 35; ?> ;
</script>
</head>
<body>
<button onclick="jst(alertMe)">Try it</button>
</body>
</html>
Develop your js within your php file.
If everything works as expected then you can outsource everything as a separate file .js
But remember : php is parsed and interpreted on server side . So everything outside php tags is completely ignored. Therefore :
<script type="text/javascript" src="jsFile.js"></script>
is pure html and will be ignored. On server side php knows nothing about the existence of these .js file and it will not load and parse it. But this is required if you want php also interpret this file too.
If you want to include it with a php file, you can do it like
Put <script type="text/javascript"> at the beginning. code completion starts again.
jsFile.php

index2.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jsFileTest</title>
<?php
include_once 'jsFile.php';
?>
</head>
<body>
<?php
echo "myID = ".$myId."<br>";
?>
<button onclick="myFunction()">Try it</button>
</body>
</html>
Running :

But now we come to the important part.
Look at the html output source :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jsFileTest</title>
<script type="text/javascript">
function myFunction()
{
alert("Hi from jsFile.php");
}
</script>
</head>
<body>
myID = idontknow<br>
<button onclick="myFunction()">Try it</button>
</body>
</html>
As you can see , javascript ( function myFuntion() ) is inserted directly in the html output. That is exactly what does not happen with
<title>jsFileTest</title>
<script type="text/javascript" src="jsFile.js"></script>
You can not use src="jsFile.php"
<script type="text/javascript" src="jsFile.php"></script>
After the parsing is finished the content is sent to the client. From this moment it is useless to even try to parse embedded php code in javascript. (the server is no longer involved , has already done its work)
IE detects an error (Status Line). when you double-click this

Error window pops up

the browser expects valid javascript code and this
$myId = "idontknow";
is not a valid JS code.
<script type="text/javascript">above yourdragger = function. Look at my updated answer at the top.