-2
Array ( 
    [0] => stdClass Object ( [question_id] => 5 [question_id_count] => 17 ) 
    [1] => stdClass Object ( [question_id] => 8 [question_id_count] => 15 ) 
    [2] => stdClass Object ( [question_id] => 9 [question_id_count] => 17 ) 
    [3] => stdClass Object ( [question_id] => 13 [question_id_count] => 13 ) 
    [4] => stdClass Object ( [question_id] => 14 [question_id_count] => 9 ) 
    [5] => stdClass Object ( [question_id] => 15 [question_id_count] => 13 ) 
    [6] => stdClass Object ( [question_id] => 27 [question_id_count] => 7 ) 
    [7] => stdClass Object ( [question_id] => 28 [question_id_count] => 2 ) 
    [8] => stdClass Object ( [question_id] => 29 [question_id_count] => 8 ) 
)

这是我的数组,我需要输出为: 17 这是最大值

4

3 回答 3

1

尝试这个:

<?php
$test = array("1" => "test", "5" => "bla", "3" => "blubb");

echo max(array_keys($test));
?>

下一个解决方案是:

$maxs = array_keys($array, max($array))

               OR

echo array_search(max($array), $array);
于 2015-12-14T05:01:45.870 回答
0
$arr = array( 10 => "AAA", 12 => "212", 17 => "SQW" );
max(array_keys($arr));

输出将是:17

于 2015-12-14T04:56:06.370 回答
0

使用arsort($your_array),然后您将获得第一个值。

于 2015-12-14T04:52:09.383 回答