I Agreed with your point that PHP is specialized for web development and Java is ideal for Mobile apps but it doesn’t mean that they both are incapable to do opposite jobs. With the support of other technologies and IDEs, it is possible to develop web and mobile apps for both of these programming languages.
It is true that PHP is for web development but it doesn’t mean to underestimate the strengths of Java. It is hard to cover every single thing in one post but with the support of Servlets and JSPs and using Eclipse IDE for Java, it is possible to develop web-based applications for enterprises and make it run on multiple platforms.