Javascript is a language that can work almost anywhere, because it is supported in almost every browser, so you are likely to be able to use it in every situation, no matter what you program. (So โโfar this is a website based)
PHP, on the other hand, begins to base its knowledge on server-side programming if you have never done this before. This allows you to use cookies and databases more efficiently than javascript, and allows you to create a real "system" where the data is stored.
Honestly, I would learn PHP first, because it will enable your javascript if you need access to databases, and it will help you learn things like AJAX and JSON.
Also, with libraries like jQuery, Javascript is getting easier to learn.
Tyler carter
source share