PHP, even PHP5, you can easily find lots of awful parts from it. Simple example:
public function showOff()
This simple example shows a couple of awful parts of PHP:
1. An instance method can be called statically as a class method, which should not be allowed(i believe)
2. Without any warning message you might expect, even, your error reporting is E_ALL. E_ALL doesn't really mean 'all', to show the warning message, you have to explicitly turn on E_STRICT.
However, even they are awful, it doesn't stop them becoming the most popular programming languages. So what are the reasons to their popularity?
Third, web itself. Web's popularity helps php & js become popular. If PHP and JS were focusing on desktop programming issues, they would never become that popular today. Fortunately, they are designed to solve web programming issues.
According to these reasons, if we want to use other 'better' languages to replace them, these languages must have these features: 1.Easy to learn; 2.Easy to solve web programming issues. Also, the pre requsite is web must still keep popular or even more popular.
So what other languages may become more popular than PHP in web programming? Based on the above criteria, none. Other languages may be better in other aspects, but at the moment i can't find one language especially designed for web programming and also as easy as PHP. Python? Obviously not designed for web programming. Is Ruby designed for web programming at the beginning? i don't think so. They are all general-purpose and try to be able to do everything. PHP is declared to be general purpose, but, obviously, web is what it focuses on. Anyone is trying to use PHP GTK to create desktop application?