Home > Backend Development > PHP Tutorial > php基础,这个程序为什么显示空白页,那里错了?怎么让它输出排序后的结果

php基础,这个程序为什么显示空白页,那里错了?怎么让它输出排序后的结果

WBOY
Release: 2016-06-13 12:31:33
Original
1503 people have browsed it

php基础,这个程序为什么显示空白页,那里错了?如何让它输出排序后的结果

本帖最后由 u013071929 于 2013-12-11 22:59:16 编辑
<?php<br />
$prodects = array(array('TIR','Tires',100),<br />
		  array('OIL','Oil',10),<br />
	  	  array('SPK','Spark plugs',4));<br />
<br />
function compare($x,$y)<br />
{<br />
	if($x[1] == $y[1]) //这里的x[1]和y[1]代表什么值?<br />
	{<br />
		return 0;<br />
	}else if($x[1]<$y[1])<br />
	{<br />
		return -1;<br />
	}else<br />
	{<br />
		return 1;<br />
	}<br />
}<br />
usort($products,'compare');<br />
<br />
foreach($products as $key)<br />
{<br />
	echo '|'.$key.'|';<br />
}<br />
echo "<br />";<br />
?><br />
Copy after login

php基础,这个程序为什么显示空白页,那里错了?如何让它输出排序后的结果,
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template