PHP gets a lot of hate for the same reason that Microsoft gets a lot of hate. PHP could have been rewritten from scratch and made more orthogonal but it would have immediately broken every existing PHP application out there. For better or worse, the install base matters. Once you a function/feature it's there to stay or you can't ever upgrade your server.