This is an old revision of the document!
PHP's gd library is missing or unable to create PNG images
Image Expression Null Value Handling
General Rules for Expression Definition
- The entire expression is one single expression resulting in one single value.
- Everything is an expression and produces one single value. So, even an
if then elseis just one expression resulting in one single value. Therefore, you can sum the results of two separateif then elses like(if the else) + (if then else). Since even the test clause of anif then elseis an expression, you can also replace that with anotherif then else. Example:if (if i1 > 0 then 1 else i2) then i2 else 1 + i3
- The
if then elsetest assumes that 0 is false and any non-zero value is true.
Null Evaluation
- Every time the expression being evaluated results in null, the entire expression becomes null. So,
i1 + nullwill always be null since something+null is always null.
- The only operators that can contain the destructive power of a null value are
isnull( expression )orexpression1 ? expression2:isnull( expression )evaluates the expression and results 1 if theexpressionevaluates to null, and 0 otherwise.expression1 ? expression2evaluates theexpression1and, if the result is non-null, returns that value. Otherwise, it evaluatesexpression2and returns the resulting value as its own result.
- Null can come from an image, but it can also be produced by some other events, such as dividing by zero, failing to find a key in a lookup table etc.
- If the
if then elsetest evaluates to null, the entireif then elseevaluates to null. Example:(if (i1/3 > 9) then i2 else 1 + i3) + 10- If
i1is null,i1/3is also null, andi1/3 > 9also becomes null. Therefore, theif then elsetest is null and the entireif then elseis null. - Now, null is being added to 10, and that also becomes null.
( (if (i1/3 > 9) then i2 else 1 + i3) + 10 ) ? 201)
- If
i1is null,i1/3is also null, andi1/3 > 9also becomes null. Therefore, theif then elsetest is null and the entireif then elseis null. - Then, null is being added to 10, and that also becomes null.
- Now, null is being caught by the expression
null ? 20, since theif then else + 10is null, and the result is 20.
1)
Note that we are using the operator
? now