Although both these languages are different, there are some similarities on a broader level.
Both the languages follow the OOPS concept. You are already aware of using objects in Java. Similar to that, in JS, too, the objects are along with the relations in between them.
When it comes to the differences between the two, a lengthy list occurs. Few of the major differences between the two are the following.
The constructors are used in Java at object creation whereas, in JS, the constructors are just a standard function.
Scope of Use
Server vs. Client Side
JS language can be embedded with HTML, XML, and AJAX. On the other hand, PHP can only be embedded with HTML. It can't be used with XML. However, there are other options to use the same with XML.