How to get the minimum value from array row

前端 未结 6 1783
情话喂你
情话喂你 2021-01-25 01:15

I trying to get the minimum values from the any column contains \"xx\" in the column name.

Below is my code:



        
6条回答
  •  长发绾君心
    2021-01-25 02:01

    function _getNumber($array) {
      return $array['id'];
    }
    $numbers = array_map('_getNumber', $array);
    

    OR

    $numbers = array_map(function($array) {
      return $array['id'];
    }, $array);
    
    echo $min = min($numbers);
    echo $max = max($numbers);
    

提交回复
热议问题