How to get the minimum value from array row

前端 未结 6 1736
情话喂你
情话喂你 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

    You have a function already for it:

    http://php.net/manual/en/function.min.php

    echo min(2, 3, 1, 6, 7);  // 1
    echo min(array(2, 4, 5)); // 2
    
    echo min(0, 'hello');     // 0
    echo min('hello', 0);     // hello
    echo min('hello', -1);    // -1
    

    Combine it with array_values if this fits better your needs.

提交回复
热议问题