PHP 数组 - 唯一匹配
嘿伙计们,我想知道你们是否能帮我解决一下我的 PHP 逻辑...
我想根据以下数据生成一个联赛表..
- 一个由 user_ids 组成的数字数组
- ,一个带有指示有多少个数值的变量两人之间要玩的独特游戏..
我需要创建一个数组来反映每个独特的游戏..
player1 vs player2
player1 vs player2
player1 vs player2
但是我不希望出现诸如
player2 vsplayer1 -
之类的欺骗行为,这将超过最大游戏数即使玩家的顺序不同,上面也将 limit 指定为变量。
我真的很难理解这个问题的逻辑,所以任何帮助都会很棒..
谢谢,
Hey guys, i was wondering if you would help me a little with my PHP logic...
I would like to generate a league table based on the following data..
- A numeric array consisting of user_ids
- a variable with a numeric value indicating how many unique games to be played between the pair..
I need to created an array to reflect each unique game..
player1 vs player2
player1 vs player2
player1 vs player2
However i do not want dupes such as
player2 vs player 1 -
This would be over the maximum game limit specified above as a variable even though the players are in a different order.
I am really struggling to wrap my head around the logic of this problem, so any help would be great..
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
跟踪配对及其匹配,如下所示:
$matches 将包含所有唯一的匹配。
Track the pairs, and their matches like this:
$matches will contain all the unique matches.
我希望你这样修改:
返回:
i hope you ment it that way:
returns: