php数字脚本数组循环
我尝试写一个脚本和一个问题。如果您知道我该怎么做,您可以告诉我吗?或者询问某人是否知道这怎么可能。
- 最多可选择 1 至 20 个号码。它可以循环并选择 1-20 之间的任何数字,
- 忽略这些数字,例如 1,2,4,6,9,12,这将是可以更改的数组。
- 每个数组行最多可以有 4 个数字
- 每个数组行必须是唯一的 5.我需要大约 10 个唯一的数组,
- 最多 2 个数字可以与之前的数字相匹配,如下所示。
我该怎么做呢?任何帮助都会很棒。
e.g. Array( [0] => Array ( [0] => 3 [1] => 16 [2] => 22 [3] => 24 ) [1] => Array ( [0] => 3 [1] => 16 [2] => 7 [3] => 13 ) [2] => Array ( [0] => 20 [1] => 17 [2] => 10 [3] => 18 ) ) This not allow as some array match each other Array( [0] => Array ( [0] => 3 [1] => 16 [2] => 22 [3] => 24 ) [1] => Array - cant have this as 3 of the numbers matchs the previous array.only two numbers can match. ( [0] => 3 [1] => 16 [2] => 22 [3] => 13 ) [2] => Array ( [0] => 20 [1] => 17 [2] => 10 [3] => 18 ) )
谢谢。
I try to write a script and a problem. Can you let me know if you know how i can do this or ask someone if they know how can this be possibe.
- Max numbers which can be selected 1 to 20 numbers. it can loop and select any number between 1-20
- ignore these numbers e.g. 1,2,4,6,9,12 this will be array which can change.
- each array line can have upto 4 numbers
- Each array line needs to be unique
5.I need to have around 10 arrays unique - Max 2 numbers can match previous numbers see below.
How can i go about doing this. Any help would be great.
e.g. Array( [0] => Array ( [0] => 3 [1] => 16 [2] => 22 [3] => 24 ) [1] => Array ( [0] => 3 [1] => 16 [2] => 7 [3] => 13 ) [2] => Array ( [0] => 20 [1] => 17 [2] => 10 [3] => 18 ) ) This not allow as some array match each other Array( [0] => Array ( [0] => 3 [1] => 16 [2] => 22 [3] => 24 ) [1] => Array - cant have this as 3 of the numbers matchs the previous array.only two numbers can match. ( [0] => 3 [1] => 16 [2] => 22 [3] => 13 ) [2] => Array ( [0] => 20 [1] => 17 [2] => 10 [3] => 18 ) )
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎满足您的条件: http://codepad.viper-7.com/WHkQeD
<强>编辑:这是一个满足您所有标准的完整解决方案。
演示
This seems to satisfy your conditions: http://codepad.viper-7.com/WHkQeD
Edit: Here is a complete solution that satisfies all of your criteria.
Demo
像这样的东西:
somthing like: