You can't.
- PHP runs on the server and outputs some text.
- The text is sent to the browser
- The browser interprets the text as HTML / JavaScript / etc
The PHP has finished running by the time the JavaScript is executed.
If you want to pass data back you need to make a new HTTP request and run a PHP script from scratch.