Doc #76875 [NEW]: It is not clear what 'uncomparable' means

From: Date: Thu, 13 Sep 2018 01:11:19 +0000
Subject: Doc #76875 [NEW]: It is not clear what 'uncomparable' means
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15986@lists.php.net to get a copy of this message
From:             manabu dot matsui at gmail dot com
Operating system: 
PHP version:      Irrelevant
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:It is not clear what 'uncomparable' means

Description:
------------
---
From manual page: http://www.php.net/language.operators.comparison
---

In table 'Comparison with Various Types', it is said that 'if key from
operand 1 is not found in operand 2 then arrays are uncomparable', and
according to Example 2, the standard_array_compare function returns null
in that case.

When I actually tried it, each operator returned the following value.

<?php
$x = ['a' => 1];
$y = ['b' => 2];

var_dump($x < $y);   # false
var_dump($x <= $y);  # false
var_dump($x > $y);   # false
var_dump($x >= $y);  # false
var_dump($x <=> $y); # 1
?>

I can not explain this result from the manual description. I think it
would be better to explain more clearly.

What is the meaning of 'uncomparable'? For example, the following can be
considered

* If $x and $y are uncomparable, $x < $y, $x <= $y, $x > $y, $x >=$y are
all false, and $x <=> $y is 1.

* It returns some kind of value, but it is indeterminate what the value
is. (The above example happened to be so, in different situations it
could be different results)



-- 
Edit bug report at https://bugs.php.net/bug.php?id=76875&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=76875&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=76875&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=76875&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=76875&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=76875&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=76875&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=76875&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=76875&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=76875&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=76875&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=76875&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=76875&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=76875&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76875&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=76875&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=76875&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=76875&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76875&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=76875&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=76875&r=mysqlcfg



Thread (4 messages)

« previous php.doc.bugs (#15986) next »