I have declared a javascript variable ,
var myJavascriptVar = 12345;
And unable to assign that value to php variable;>
You should see these links:
Assign Javascript value to PHP variable
Passing Javascript vars to PHP
Or you can use AJAX request or POST and GET methods to achieve this.
Snippet below may helpful for you:
Your name: