For example:
$(document).ready(function(){
$(\'.selector\').click(function(){
});
});
PHP is a "backend" language and javascript is a "frontend" language. In short, as long as the PHP code is loaded through a web server that understands PHP - the downside is that you have to inline the JS, losing caching ability (there are workarounds to parse php in .js files but you shouldn't really do this). To the user it will just look like javascript and HTML. Here's the server order:
Just be sure the PHP is outputting valid JavaScript.