源代码是这样:
 <html>
  <head><title>array test</title></head>
  <body>
  <?php
  $products=array(
  array("apple",100),
  array("banana",10),
  array("watermelon",5)
  );
 
  Function compare($x,$y){
  if($x[1] > $y[1]){
  return 1;
  }else if($x[1]=$y[1]){
  return 0;
  }else if($x[1]<$y[1]){
  return -1;
  }
  }
  usort($products,"compare");
  for($row=0; $row<3; $row++){
  for($clo=0;$clo<3; $clo++){
  echo $products[$row][$clo]."     ";
  }
  }
  ?>
  </body>
  </html>运行报错:
watermelon 5 
Notice: Undefined offset: 2 in D:\Apache Software Foundation\Apache2.2\htdocs\array.php on line 23
banana 10 
Notice: Undefined offset: 2 in D:\Apache Software Foundation\Apache2.2\htdocs\array.php on line 23
apple 100 
Notice: Undefined offset: 2 in D:\Apache Software Foundation\Apache2.2\htdocs\array.php on line 23看报错应该说的是echo $products[$row][$clo]."     ";有问题,请大家帮忙看下,初学php请大家多指教,谢谢!