0. No out-of-the-box framework for MVC or other frameworks for organizing your homepage
If you want to use a MVC framework or a template system, you either have to rely on a 3rd party implementation or write your own. No such thing in the PHP standard library.
1. PHP is a weak-type language
In PHP we do not care about types. If you used this variable for Foo, but you want to store an integer in it? Sure, why not? In PHP, we define the type of our variable/return-value/parameter in a comment. If you accidentally use the wrong value in a 200 lines long algorithm, PHP wouldn't even bother you that you are using the parameter value instead of a value inside a table.
2. Lack of proper and clear documentation
Although every function in PHP is documented, you have to think twice in some cases. A good example is the str_replace function. The description for str_replace says the function is declares as following:
mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] )
You would think that the $search value is the string you want to perform the string replace function on until you see the subject parameter. But wait, maybe subject is the value you want to search for, or wait - is that $replace?
In C#, it is solved as string Replace(string oldValue, string newValue).
A better declaration would perhaps be:
mixed str_replace ( mixed $oldValue , mixed $newValue , mixed $subject [, int &$count ] )
3. Lack of design for secure code
This is a side-effect of that it is a weak-type language. Instead of defining that this parameter is an integer (well, those of us that actually write comments have this here but comments does - surprisingly not have any affect on our code execution) you have to manually check that it is an integer. PHP almost got this fixed by adding type-hinting where you can define the types of the parameters to your functions. But there is a catch (as with everything else in PHP) - you can only use type-hinting if there are objects. Arrays, integers, strings, etc. are not supported for this feature. This way you have to add if checks for every single variable then perhaps throw an InvaldiArgumentException if you integer is a string instead.
4. No overloading of functions
For whatever reason, PHP does not support this feature. If you have a "function getUser($userID)", you cannot write "function getUser($userID, $password)". Amazingly enough, PHP does have default parameter values though.
5. No consistent style of API functions
One example is the DateTime object and other PHP library functions. Most functions in the PHP library are like some_function(). Then suddenly DateTime has a function named someFunction() instead. Although I prefer the last notation, my code gets inconsistent when I use different programming styles to call simple library functions.
6. Every variable is declared with a $
I have to find the Alt Gr button then hit the 4 key to get a dollar sign. Of course, var is another key extra, but it is a lot easier to type than a $ sign.
7. Where are my enums?
PHP does not support enums. Instead we define our values as consts under a class. Want to make sure your value is a valid "enum"? Then you must write a function for that.
8. Lack of good habits in example code and forum threads
PHP is an incredibly simple language. Someone can easily learn PHP if they have any background in another programming language, and people with no programming background can also easily read and understand PHP code. There is one problem with this: The easier a language is, the lower quality will there be on code floating around the net. This makes it harder to become really good at writing good PHP code as most of the example codes around the web contains at some point bad habits which prevents you from learning how to write good PHP code.
9. What's up with the underscores?
I have to write __ when I override system functions like toString and constructor. Why can't I just write a function Foo() as the constructor declaration for my class Foo?
PHP is not a bad language, neither a good one. It seems that PHP is getting old and more and more hairy after time. If I had the choice, I would write my homepage in C# or Java if this was an option. Although there is a lot of hate around PHP, PHP is still good in some cases.
Documentation is something we are encouraged to make already from the first class of programming. But the fact is that we are really lazy when it comes to commenting our code. It is what we do after we code and we often tend to skip it. In PHP it is a common practice to comment the return type of a function in the comments above the function by using the @return directive. C-based languages always declare the return type. public static int getInteger(); In PHP it would be public static function getInteger(). If someone from a strong-typed language begins to read PHP code (if there are anyone of those), things can get quite confusing. "Wait, it is supposed to return something, but it clearly says it is a function!" The programmer thinks function = void as this is always used in Java.
For whatever reason, PHP has decided to allow programmers to declare the type of the input parameters to a function with one exception: Data types such as integer, strings, floats, etc. are not allowed. This caused frustration when I thought my PHP code actually was wrong a while ago when I got the error "Argument 1 passed to function() must be an instance of integer, integer given". And for whatever reason, type-hinting is not supported on functions with a return type.
Web-languages are from a different world. They are easy and they most likely doesn't work the way you expect them to work. There are no standards, and everyone wants to implement a feature different than anyone else because their way is the best and only way to do it. Sure, it is easy to write PHP code. But the amount of documentation required is higher than C#. Self-documenting code is a key-word. It makes me glad to think about that I didn't chose to become a web-developer as I honestly do not understand how web-developers are able to sleep during the night.