I am not sure if a line of PHP could be run inside of a JavaScript function. For example:
You're getting it the other way around. Your main file is PHP, and the PHP parser will interpret that and create a HTML page out of it, which may or may not contain JavaScript. This file will be sent to the client, and the client will then interpret any JavaScript.
JavaScript = client side.
PHP = server side.