Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116549 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76011 invoked from network); 1 Dec 2021 14:01:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Dec 2021 14:01:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9AC861804B5 for ; Wed, 1 Dec 2021 06:59:53 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8560 212.227.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 1 Dec 2021 06:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1638370789; bh=ygyDGuDSbprw/lQHIH2+OiJIAD6D2ExlANinX/Jfghs=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=Z43ve4v5EgG3jXcqwCU3yDj3jBrvdoE5Hp/TZACFJTxPpy0juJvjfOrTTqPP1EWM2 JFBb2FK0u/vHxPvHdqeQBY3Nvm3JdXd4WyKMOU3I15VqLl2p86CN3fKfB4ofE5YKBO kEyP+JvQlccjtNQq31Lti36Z1T2lWiXwIy64UlNI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.2.130] ([84.179.239.183]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MOiHf-1nEmd93d7f-00QAIC; Wed, 01 Dec 2021 15:59:48 +0100 Message-ID: <13e98142-db4e-dbe8-7474-ab15d59af95b@gmx.de> Date: Wed, 1 Dec 2021 15:59:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Content-Language: de-DE To: =?UTF-8?B?QW5kcsOpIEjDpG5zZWw=?= , internals@lists.php.net References: <087101d7e6bb$30f27d70$92d77850$@webkr.de> In-Reply-To: <087101d7e6bb$30f27d70$92d77850$@webkr.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:CC27AQSE+aP7qRCpf1YLuKKfXkfI2GiWf9mianyXkdUK5z6K1Kw AZfialJ/8Axxo4xh5Cd1PB15s1Ra045tJChizOqQnLhENfFM5Nrf5azey0cG8Ds6ajC66yK qpX/znSW3uVQOFXU99wA5vDkV6RGm4EiRLuoHcxWUOnzLJhhgbP1IUhtDK98WCWyl/Xxw9k XSugGy3m4GOoxRqia8Wgw== X-UI-Out-Filterresults: notjunk:1;V03:K0:QQAv2z1J5aQ=:piVN7BgZuQDtP5xI/UY2gc IXJK27F2ayKN1qxdg1OHlAz4LYpmZL5vKBkfCtqm45dVvye4kAzQJojKjUq3dAQjuaX9ZVtW6 C21Vj9LAcm3GsD+/E+IbwfBCv78VMmZgYEt3gz9blfiLyU6DMsAyCNBgNodhZ96S/NZW9wsHV cpNg/zRru9B2ofH1MitfXsD665pTvgBKrQXTQXnFViL1B4GBzJptK5taOUmBS0XDDdN9ujxrQ ZQnb8Wavwe7W4rzEPTI2SMTGHH6z/W0jP0sRINwjnWWa44AYRwiqlVi/+X+7TsUm9/oiAqkTg eAiDVkXyPAxkxExdgNPLlfTr4s0pooe8M7wfJQPoSpOVleWmVUNw0maPuU3Sbji1WijF70IHu 29nxA7X1EKnG1PpaSwy5i6V2UlAGsLc3fNYbrwKY9eg/5EiSVpttGiZP1rK/FYzdlBejaFd5v /354OXmXaPa+Usp3TQLL1oYLcHIYi4ysf0+hqvMGauAA4RJAweefCWymzEaJbDmwJWdyZ1Abd KYe/HnC82RDn/2V6t9nX7IMj5jLFLDKkPim9Q87JmDif/oNEHdF1B3IUaZeLEqxoO7MHHyaGW Ya0zxT9tK88m/U5k4lsnVZacMaTlbPvuBoJpZ57fio7XOyIsdiO/QNUvQIPrndV6nmbQUAahG Sx4D4F16xMvYHU/Iw04x7JBgMSYzC1j9B3PoxxGUCx4JyhhUZEgrkMx51p9t/pB/XV7OjEn4q 68sxtB2kihLBt2JIZswVTjaQfxrmkPsPvW6qOBWIir0waO44FzbvK/bVGsRyshr683wd08eoX L0zMXPmhfNjXkqmxto0t5d+C+HnRxGYCMjGKaIJy/LDa3K8Rdbm2Xbg5LwIzOl7QHR1hDrLaN OblEG01Rgv5YrRn3NlBxHgM1XZYym1ctNi6tq2iWJN27jci6RXQ6dTYtjRrYm3LHRLjRxYJtJ MOK+iwhnkIG8cnbFw1J9BUrgA8tw4KClHzi7bXNYnnEBjZcYbMV/tnKG5FzBczwwScve8vMML JoKuj7YUc/OPAXL32XigVxBrLB/gBnusJbXQ0FzMOihji8K8kXXpyeVvLBfsurXbsSYpBhIJf L2uW5hiHIFAhwU= Subject: Re: Array comparison works completely different than documented? From: cmbecker69@gmx.de ("Christoph M. Becker") On 01.12.2021 at 14:56, Andr=C3=A9 H=C3=A4nsel wrote: > The official documentation contains a conceptual description of array > comparison in > https://www.php.net/manual/en/language.operators.comparison.php#example-= 113. > > Curiously the people who wrote the inofficial spec (I think the HHVM tea= m at > Facebook?) came to > pretty much the same result, described in > https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#r= elat > ional-operators: > >> If both operands have array type, if the arrays have different numbers = of > elements, the one >> with the fewer is considered less-than the other one, regardless of the > keys and values in each, >> and the comparison ends. For arrays having the same numbers of elements= , > the keys from the left >> operand are considered one by one, if the next key in the left-hand > operand exists in the >> right-hand operand, the corresponding values are compared. If they are > unequal, the array >> containing the lesser value is considered less-than the other one, and = the > comparison ends; >> otherwise, the process is repeated with the next element. If the next k= ey > in the left-hand >> operand does not exist in the right-hand operand, the arrays cannot be > compared and FALSE is >> returned. If all the values are equal, then the arrays are considered > equal. > > In reality, array comparison works completely different, it is however > unclear to me how exactly > it does work: https://3v4l.org/630vG The point is that $a > $b is actually checking whether $b <=3D $a. This is fine for ordered values, but these arrays are not orderable (according to PHP's comparison). That might indeed not be documented in the PHP manual (the language specification appears to be abandoned anyway)= . =2D- Christoph M. Becker