As gdoron points out, this isn't exactly possible, so let me roughly explain how to do what you seem to want to do.
When someone visits your site for the first time, their machine (and their browser running on their machine) sends an HTTP request to your server. At that time, the PHP in the requested page runs on your server. The Javascript at that time does not run, it's just meaningless text like any other text or HTML or CSS on the page.
Once the PHP is done running, HTML, CSS and Javascript is sent to the browser - the PHP that ran on your server does not go with it.
Now, the browser receives all of this and parses it, and runs the Javascript.
Here's a terrible text drawing of this process:
Browser
--> Server (PHP) --> Browser (HTML/CSS/JS)
So you can see that it's not possible for you to just convert a Javascript variable value to PHP, because they run at different times - the PHP on your page has already run and finished by the time the Javascript starts, and they run in different places.
So, if you have values in Javascript that you want to process with PHP, you first need to bundle them up into JSON, then send them over AJAX to the server, to a page that's listening for those values that reacts accordingly. You can see an example here:
using jquery $.ajax to call a PHP function
Hopefully that clears up the basic confusion so you know where to go next with your learning.