JavaScript is a client-side technology and PHP is a server-side technology. This means that the JavaScript code executes on the browser and the PHP code executes on the server. You cannot have server-side code execute based upon the logic executed by the client-side code, at least, not directly.
It would seem that you are wanting to do a check for the functionality of JavaScript. Is this correct? If so, there are many ways to do this, but none of them involve PHP.