Re: Double check of variables.




<opt_inf_env@xxxxxxxxx> wrote in message
news:1122204562.018664.45780@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hello,
>
> In some examples of a PHP implementation I saw the following:
> if ( isset(x) and x==12)
> I do not understand what for before to check whether some variable has
> some value one need to check whether this variable is set. If the
> second condition is true than the first one is also true, isn't?
>

The order of checking here is the same as in C, C++, Java, etc. It checks
the first condition. If that fails, it does NOT check the second condition.
If you were to check the second condtion only, then it might cause an error
condition that produces undesirable results. In the case you cite, that
probably won't happen. It is generally used best when you might have a
pointer off into never-never land. So, it is good programming practice to
alway be CERTAIN that your variable being tested actually exists before
testing its value.

Shelly


.



Relevant Pages

  • Re: Conditional Formatting With Grades
    ... Say your grades ... First Condition ... Second Condition ... Third Condition ...
    (microsoft.public.excel.worksheet.functions)
  • Re: using 2 If statements
    ... I am using Verilog-a.. ... They are evaluated in sequence. ... In fact if the first condition in the first if state is false, the second condition isn't evaluated either. ...
    (comp.lang.verilog)
  • CountIF formula
    ... I need to run a countif formula, with 2 conditions on two different ... columns, The first condition is that column D matches cell A1, ... the second condition is that column K is greater than 0. ...
    (microsoft.public.excel)
  • Re: conditions in Excel
    ... Assume the first condition is not met then you say you ... Frank Kabel ... Peter L wrote:> Hi Frank and thanks for your answer> If it not too mutch trubble I would like to have both a worksheet> formula or a VBA solution? ... > In your answer you wrote that:"your first and second condition are> identical but you want different ...
    (microsoft.public.excel.programming)

Loading