Hi Jay,
I'm in a similar situation. I've just taken on the team lead role with a company who's primary tech is PHP after coming from a Java background of 11+ years.
I'm working on a brand new product for the company. All the existing code is based on old versions of PHP so they have not been able to get leverage from any of the many modern PHP libraries out there. Anyway, my project doesn't have that restriction so I've been looking at using things like Doctrine, which provides Hibernate style ORM, annotations and other cool stuff, that would be pretty bog-standard fare in Java-land.
I've been trying to build a list of differences between Java and PHP. So far, in terms of how OO is implemented PHP is pretty close to Java. It only seems to be missing nested classes and anonymous inner classes, but of course it has functions and closures, so that mitigates the usefulness of having nested/anonymous inner classes to some degree.
The one thing that is annoying me though, is lack of static typing. Take these PHP classes:
You have no idea what types engineer and reporter are, though you can probably have a good guess from the classes I've listed what they might be, but if there were 100s of clases in your project ... well it gets a lot harder a lot more quickly. However, you can get around this to some extent by using static typing on setters:
But that's still not great. Also - that with PHP you're syntax isn't checked until runtime (that's mitigated by having a good
IDE, I'm currently using Zend Studio, and
unit tests for everything!).
Sometimes I feel like going to my boss and asking to use Java. Once he'd finishing throwing footballs and other office toys at my head I'm sure he would say no for a number of reasons:
0) "We're PHP" (I could mitigate this by saying that the developers are all experienced with OO and could pick up Java quickly enough, I suppose)
1) There is some level of re-use that we can get from our existing codebase (this is true as my project does share some concepts with the existing code)
2) PHP is much easier to manage on the infrastructure than Java
What he would mean by #2 is that in Java-server-land, you have to make careful architectural decisions about vertical scaling (making better use of existing hardware, multiple VMs, etc) and horizontal scaling (adding new hardware). In PHP land vertical scaling is pretty much there for free, then all you have to worry about is horizontal scaling. Then at a software level, in Java land you worry about which VM to use, which server you're going to use and all that, but in PHP land it's just Apache and PHP (though yes, there are commercial options, like Zend).
In terms of process we use TDD via PHPUnit and have continuous integration with Cruise Control, SCM by SVN (though I am considering GIT) and so on, so very little difference there.
There was something else that I discovered was not possible to do with PHP that is possible with Java, but can't remember just now what it is. I'll update this
thread if it comes back to me.
Anyway... both have their pros and cons, and you're not the only one out there wondering why one or the other from time to time.