php redis sinter,sInter 命令/方法/函数

Returns the members of a set resulting from the intersection of all the sets held at the specified keys. If just a single key is specified, then this command produces the members of this set. If one of the keys is missing, FALSE is returned.

返回指定SETS集合的交集结果。如果只是指定了一个SET集合,那么返回该SET集合。如果在参数中有参数错误,那么则返回FLASE。

Parameters

key1, key2, keyN: keys identifying the different sets on which we will apply the intersection.

参数列表,代表不同的SET集合。

Return value

Array, contain the result of the intersection between those keys. If the intersection beteen the different sets is empty, the return value will be empty array.

返回数组,数组中的结果为所有SET集合的交集。如果所涉及到的SET集合没有交集结果,那么将返回一个空数组。

Examples

$redis->sAdd('key1', 'val1');

$redis->sAdd('key1', 'val2');

$redis->sAdd('key1', 'val3');

$redis->sAdd('key1', 'val4');

$redis->sAdd('key2', 'val3');

$redis->sAdd('key2', 'val4');

$redis->sAdd('key3', 'val3');

$redis->sAdd('key3', 'val4');

var_dump($redis->sInter('key1', 'key2', 'key3'));

Output:

array(2) {

[0]=>

string(4) "val4"

[1]=>

string(4) "val3"

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值