Complaining about PHP

Source: Internet
Author: User
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.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.