PHP to Java
What an interesting comparison - to me at least...
In my very limited understanding, PHP is pretty much universally used server-side for producing web pages. Java is mainly used for applications. (Does anyone still use JSP and Applets?) So in that sense, they are not even comparable. It would be very tricky to replicate the function of one with the other.
If I had to chose between them I would opt for Java as I do know a little. I had to take a Java programming module at university but it was pretty simple stuff. I have also created a few basic Android apps using Java. Whereas PHP I know nothing about other than looking at some code a few times and instinctively not liking what I saw.