I've spent years on both sides of the fence, PHP and Java. In my experience php wins out for prototyping and smaller or short-lived projects, because you can type up something quickly without boilerplate, but java is better for large long-lived codebases. The improved maintainability that a strictly typed language gives you becomes the dominant factor when 80% of time is spent maintaining or extending existing code.