Recently doing projects in PHP. In general, I think this open source language is very good, but there are some places I am extremely uncomfortable, such as weakly typed variables, variables can be used without declaration, and so on.
Take the Friday thing for example, there was a function that returned different results depending on the option of the parameter:
Define ("Option1", "option1");
Define ("Option2", "option2");
function get_something ($option = option1) {
if ($option = = option1)
Do_something1 ();
ElseIf ($option = = option2)
Do_something2 ();
}
?>
I call this function, expect to be able to do_something2 (), the result is not the result I want to kill, I thought I passed the parameter has a problem, I have been looking at the code to generate this parameter section, took 30 minutes, finally found out where the problem, the original I put get_ The second $option in something was written $opion: (
Maybe someone would say that it was because I was careless, and if I was careful, it wouldn't happen. But I do not agree with this statement, from ancient times, who can not make mistakes? If PHP is like the Option Explicit VB, then the script will be interpreted when the error, rather than generate an unexpected result to confuse my view, I do not have to spend 30 minutes to find this bug, causing this trouble more due to the design of PHP itself.
Although the most important thing in software is the programmer's mind, but I also think that an efficient language is more important, from this point of view. NET and Java are really powerful, both. NET is more efficient when it comes to small and medium-sized enterprises, and has no contact for a while. NET, hope in the future 3.0, 4.0 will be more and more good.