PHP and undefined variables strategy

前端 未结 12 1098
名媛妹妹
名媛妹妹 2021-01-17 09:49

I am a C++ programmer starting with PHP. I find that I lose most of the debugging time (and my selfesteem!) due to undefined variables. From what I know, the only way to dea

12条回答
  •  无人共我
    2021-01-17 10:32

    Good practice is to define all variable before use, i.e., set a default value:

    $variable = default_value;

    This will solve most problems. As suggested before, use Xdebug or built-in debugging tools in editors like NetBeans.

提交回复
热议问题