PHP max函式的用法

2021-09-18 07:15:09 字數 780 閱讀 4854

定義和用法

max() 返回乙個陣列中的最大值,或者幾個指定值的最大值
語法

max(array_values); or max(value1,value2,...);
引數

描述array_values

必需。規定乙個包含值的陣列

values1,values2,…

必需。規定要比較的值(至少兩個值)

<?php

echo max(1, 3, 5, 6, 7); // 7

echo max(array(2, 4, 6));// 6

echo max(0, 'hello');// 0

echo max('hello', 0);// 'hello'

echo gettype(max(0, '0'));// integer

echo gettype(max('0', 0));// string

echo max(-1, 'hello');// hello

//對於多個陣列,max從左向右比較。 例如?

var_dump(max(array(2,4,8), array(2,5,9)));// array(2,5,9)

// 如果同時給出陣列和非陣列作為引數,則總是將陣列視為最大值返回

var_dump(max("string", array(1,2,3), 34));

函式的用法 INDEXC函式的用法

1 製作小 箱 如何利用excel製作簡單的小 箱?這裡與大家分享借用index函式來實現。在單元格中輸入公式 index a2 a17,randbetween 2,counta a2 a17 公式說明 counta函式表示統計非空單元格格式 randbetween函式表示隨機生成整數 2 隔行提取...

函式的用法 CELL函式高階用法,

資料多時看的眼花繚亂,使用聚光燈功能突出顯示當前的行和列,在檢視資料時非常方便,wps是自帶該功能的。選中要設定的資料區域,在 開始 選項卡下點 條件格式 選擇 新建規則 在彈出的 新建格式規則 視窗中選擇 使用公式確定要設定格式的單元格 在 為符合此公式的值設定格式 下輸入公式 or cell r...

lseek函式的用法lseek函式的用法

使用 lseek 函式可以改變檔案的 cfo include unistd.h include off t lseek int filedes,off t offset,int whence 返回值 新的偏移量 成功 1 失敗 引數 offset 的含義取決於引數 whence 1.如果 whenc...