|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-12-17 09:12 UTC] rjhdby@php.net
Description: ------------ --- From manual page: http://www.php.net/function.variant-imp --- Truth table for bitwise implication is not correct. Must be If left is If right is then the result is TRUE TRUE TRUE TRUE FALSE TRUE >> FALSE TRUE NULL TRUE >> FALSE FALSE TRUE TRUE FALSE FALSE TRUE FALSE NULL TRUE NULL TRUE TRUE NULL FALSE NULL >> TRUE NULL NULL NULL >> TRUE PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 18:00:01 2025 UTC |
When I try foreach ([true, false, null] as $i) foreach ([true, false, null] as $j) { $v = variant_imp($i, $j); $v = (variant_get_type($v) == VT_NULL ? null : (int)$v); printf("variant_imp(%s, %s) = %s\n", json_encode($i), json_encode($j), json_encode($v)); } I get variant_imp(true, true) = -1 variant_imp(true, false) = 0 variant_imp(true, null) = null variant_imp(false, true) = -1 variant_imp(false, false) = -1 variant_imp(false, null) = -1 variant_imp(null, true) = -1 variant_imp(null, false) = null variant_imp(null, null) = null true->false should be false ("true implies false" is wrong). true->null, null->false, and null->null should all be unknown.My mistake in previsious comment. You are right, "true->false should be false ("true implies false" is wrong). true->null, null->false, and null->null should all be unknown."