PHP scripts run on server side and results in combination of HTML codes to client machine resulting in a complete page that user can see. Javscript runs on client machine.
two ways out:
1. if you are using a .js
anywhere in the php code, either in body part or in header part of php file.
2. if you are not including a .js
you should write code like:
i hope this clarifies.