定義和用法
stats_stat_percentile() 函數可以返回百分位值。
用法
float stats_stat_percentile( array $arr, float $perc )
參數
Sr.No | 參數 | 描述 |
---|---|---|
1 | arr |
輸入數組 |
2 | perc |
百分位 |
返回值
stats_stat_percentile() 函數可以返回數組 arr 的 perc-th 百分位值。
依賴關係
這個函數最初是在統計擴展(PHP 4.0.0 和 PEAR 1.4.0)中引入的。我們在本教程中使用了最新版本的 stats-2.0.3(PHP 7.0.0 或更高版本和 PEAR 1.4.0 或更高版本)
示例
在以下示例中,我們計算數組的第 50 個百分位值。
<?php
var_dump(stats_stat_percentile(array(1, 3, 2, 4), 50));
?>
輸出
這將產生以下結果 -
float(2)
示例
在以下示例中,我們計算數組的第 50 個百分位值。
<?php
var_dump(stats_stat_percentile(array(1, 3, 5, 2, 4), 50));
?>
輸出
這將產生以下結果 -
float(3)
相關用法
- PHP stats_stat_powersum()用法及代碼示例
- PHP stats_stat_paired_t()用法及代碼示例
- PHP stats_stat_binomial_coef()用法及代碼示例
- PHP stats_stat_factorial()用法及代碼示例
- PHP stats_stat_correlation()用法及代碼示例
- PHP stats_stat_innerproduct()用法及代碼示例
- PHP stats_stat_independent_t()用法及代碼示例
- PHP stats_standard_deviation()用法及代碼示例
- PHP stats_dens_pmf_binomial()用法及代碼示例
- PHP stats_cdf_chisquare()用法及代碼示例
- PHP stats_cdf_t()用法及代碼示例
- PHP stats_rand_gen_iuniform()用法及代碼示例
- PHP stats_cdf_exponential()用法及代碼示例
- PHP stats_harmonic_mean()用法及代碼示例
- PHP stats_cdf_normal()用法及代碼示例
- PHP stats_rand_gen_ipoisson()用法及代碼示例
- PHP stats_dens_laplace()用法及代碼示例
- PHP stats_cdf_poisson()用法及代碼示例
- PHP stats_rand_gen_beta()用法及代碼示例
- PHP stats_cdf_beta()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP - Stats Stat Percentile() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。