Kit.Lester wrote:
> Trying   to  learn  PHP   *well*,   I've   bogged   down  on  table   15-5  in
> http://www.php.net/manual/en/language.operators.comparison.php  - it claims to
> describe  comparisons  between  different types, but then has a lot of missing
> combinations,  some internal  clashes, a few bits which leave me in doubt, and
> then  *does*  cover most of the  same-type  comparisons  at various  levels of
> explicitness.

I'm the author of the table, thanks for your interest. The main point
to understand the table is read it from top to bottom (and not try to
find the proper line at first sight). Operands are tested for the type
in this order. Knowing this fact, you will find that every possible
combination is listed.

> TABLE 15-5 CLAIMS IT IS FOR "DIFFERENT" OPERAND TYPES

"Different" should be "various". I've fixed it in CVS.

>  -- implicitly might be covering bool vs bool array vs array
> leaving only null vs null uncovered... :-)

null vs null is covered on the line "bool or null vs anything".

> QUERIES IN THE TABLE:
>  -- "numeric or lexic  comparison"  presimably  means that if both strings are
>     numeric,  they  are cast to  numeric  and  compared  -- but (1) what is a
>     "numeric" string? - one that starts with + - or a digit, so that trailing
>     non-numeric  data is ignored? so "115  Somestreet"=="115  Anotherstreet"?
>     (2) what of the case where only one string is "numeric"?

Numeric string consists of digits only and optional plus/minus and
optional decimal point. You can test it with is_numeric().

>  -- does array-vs-anything cover array-vs-array? isn't a-vs-a special?

array vs array has its own line.

> CLASHES (i.e. appear twice):
>  -- null op string
>  -- string op string (assume the explicit string vs string overrides the
>     string-etc vs string etc?)
>  -- does  reources  resource  cast to numeric?  oris that  excluded  from that
>     entry? or does it matter?

I hope that with the "read the table from top to bottom" fact is
everything clear. E.g. string vs string is matched on the first line
of course, 4th line matches s-n, s-r, n-s, r-s, n-n, r-r, n-r, r-n.

Jakub Vrana

Reply via email to