It could be, but I'm not sure why you'd want to do it as it would be extremely slow? The point of Javascript, usually, is that it is executed in the browser rather than on the server, where PHP is usually executed.
If you mean you want to automatically generate client side Javascript in your PHP code, then there are a number of frameworks which will provide this sort of functionality, for example symfony or AjaxAC.
If you really want to run Javascript on the server side then the only solution I know of is Rhino, but that is based on Java rather than PHP.