PHP判断多维数组值的大小
Array([0]=>Array([name]=>player_1[shape]=>0[cards]=>Array([0]=>Array([0]=>13[1]=>2[2]...
Array
(
[0] => Array
(
[name] => player_1
[shape] => 0
[cards] => Array
(
[0] => Array
(
[0] => 13
[1] => 2
[2] => 10
)
[1] => Array
(
[0] => 12
[1] => 3
[2] => 10
)
[2] => Array
(
[0] => 10
[1] => 4
[2] => 10
)
)
)
[1] => Array
(
[name] => player_2
[shape] => 0
[cards] => Array
(
[0] => Array
(
[0] => 9
[1] => 4
[2] => 9
)
[1] => Array
(
[0] => 7
[1] => 4
[2] => 7
)
[2] => Array
(
[0] => 4
[1] => 1
[2] => 4
)
)
)
)
:第一个里面shape值=0,第二个里面shape值也=0,然后根据cards[0][0]的内容来判断大小,比如第一个的cards[0][0]=13,第二个cards[0][0]=9,那么结果就是第一个大 展开
(
[0] => Array
(
[name] => player_1
[shape] => 0
[cards] => Array
(
[0] => Array
(
[0] => 13
[1] => 2
[2] => 10
)
[1] => Array
(
[0] => 12
[1] => 3
[2] => 10
)
[2] => Array
(
[0] => 10
[1] => 4
[2] => 10
)
)
)
[1] => Array
(
[name] => player_2
[shape] => 0
[cards] => Array
(
[0] => Array
(
[0] => 9
[1] => 4
[2] => 9
)
[1] => Array
(
[0] => 7
[1] => 4
[2] => 7
)
[2] => Array
(
[0] => 4
[1] => 1
[2] => 4
)
)
)
)
:第一个里面shape值=0,第二个里面shape值也=0,然后根据cards[0][0]的内容来判断大小,比如第一个的cards[0][0]=13,第二个cards[0][0]=9,那么结果就是第一个大 展开
展开全部
$arr = [
[1, 2, 3, 4, 5],
[1, 2, 3, 4, 5, 6, 7, 8],
[1, 2, 3, 4, 5, 6, 7]
];
echo count($arr); // 3 二维数组长度
echo count($arr[0]);// 5 二维数组子数组长度
echo count($arr[1]);// 8 二维数组子数组长度
你可以去后盾人平台看看,里面的东西不错
[1, 2, 3, 4, 5],
[1, 2, 3, 4, 5, 6, 7, 8],
[1, 2, 3, 4, 5, 6, 7]
];
echo count($arr); // 3 二维数组长度
echo count($arr[0]);// 5 二维数组子数组长度
echo count($arr[1]);// 8 二维数组子数组长度
你可以去后盾人平台看看,里面的东西不错
追问
我是需要比对数组里面值的大小,取出最大的,而且你说的这个盾人平台,百度没搜索到
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询