PHP is a server side scripting language and javascript is a client side one. This means the php code executes itself on the server and the javscript code executes on your computer. This mens that you cannot insert javascript variables into the php script that has already executed. You can insert javascript variables into a php script by GET or POST through XMLHttpRequest (XHR). This way you can get a response from your PHP script without leaving the page.
I just wanted to know because I want to create a dyanamic website, and I was hoping to include some sort of text editor so my visitors can post articles. Does anyone have any suggestions?