⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example.php

📁 PHP4_0入门与提高源程序代码
💻 PHP
字号:
<HTML>
<BODY BGCOLOR="white">
<PRE>
<?php

require("class.hist");

//构造一个测试数组
$vals = array(
			1.5,2,3,4,0,3.2,0.1,0,0,5,3,2,3,4,1,2,4,5,1,3,2,4,5,2,3,4,1,2,
			1.5,2,3,4,0,3.2,0.1,0,0,5,3,2,3,4,1,2,4,5,1,3,2,4,5,2,3,4,1,2,
			1.5,2,3,4,0,3.2,0.1,0,0,5,3,2,3,4,1,2,4,5,1,3,2,4,5,2,3,4,1,2
		);


//创建一个实例 
$h = new Histogram;

//计算并输出结果
$h->create($vals,6,"Test 1");
$h->printStats();
$h->printBins();

//直接进入结果数组

$result = $h->getBins();
echo "\n\nresult is of type: ".gettype($result)."\n";
while (list($key,$val) = each($result)) {
	echo $key."\t".$val."\n";
}

$result = $h->getStats();
echo "\n\nresult is of type: ".gettype($result)."\n";
while (list($key,$val) = each($result)) {
	echo $key."\t".$val."\n";
}

//创建另外一个实例
echo "\n\n============\n\n";
$k = new Histogram($vals,7,"Constructed histogram");
$k->printStats();
$k->printBins();

?>
</PRE>
</BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -