ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

4-2-2 ¤Gºû°}¦Cªº¦s¨ú

4-2-2 ¤Gºû°}¦Cªº¦s¨ú

4-2-2   ¤Gºû°}¦Cªº¦s¨ú
­n¦s¨ú¤Gºû°}¦C¤¸¯Àªº¸ê®Æ«Ü²³æ¡A´N¦p¦P³B²z¤@ºû°}¦C¡A¤£¹L¡A§Ú­Ì¥²¶·¦P®É«ü©w¤¸¯Àªº¦Cµù¼Ð»P¦æµù¼Ð¡A¨Ò¦p¡G
  1. $Myarray [0][1] = 999;  //±N¸ê®Æ¦s©ñ¸m°}¦C¦ì¸m[0][1]¤¤
  2. $Myarray[1][2] = 888;  //±N¸ê®Æ¦s©ñ¸m°}¦C¦ì¸m[1][2]¤¤
  3. //¨ú¥X°}¦C¦ì¸m[0][1]»P[1][2]ªº¸ê®Æ¬Û´î¡A¨Ã¦s¦Ü°}¦C¦ì¸m[3][3]¤¤
  4. $Myarray[3][3]= $Myarray[0][1]- $Myarray[1][2];
½Æ»s¥N½X
¦pªG­n¥H°j°é±Ô­z¨Ó¦s¨ú¤Gºû°}¦Cªº¸ê®Æ¡A«h¥²¶·¨Ï¥Î±_ª¬ªº°j°é¡A§Ú­Ì¥Hfor±_ª¬°j°é¿é¥X½d¨Òex04_13.php¡]¹Ï4-11¡^¤Gºû°}¦C¤ºªº¸ê®Æ¨Ó»¡©ú¡G

¹Ï4-11   ex04_13.php¡C
ex04_13.php
  1. <HTML>
  2. <HEAD>
  3. <TITLE>ex04_13</TITLE>
  4. </HEAD>
  5. <BODY>
  6. <?
  7. $Student=array(
  8. "0"=>array(0=>"©m¦W",1=>"°ê¤å",2=>"­^¤å",3=>"¼Æ¾Ç"),
  9. "1"=>array(0=>"¤p»x",1=>100,2=>90,3=>80),
  10. "2"=>array(0=>"±oµØ",1=>60,2=>100,3=>70),
  11. "3"=>array(0=>"«F«Ê",1=>90,2=>80,3=>90),
  12. "4"=>array(0=>"¾Ç¦³",1=>65,2=>90,3=>80));
  13. ?>
  14. <table border=1>
  15. <?
  16. $i=count($Student);
  17. for($x=0;$x<$i;$x++)
  18. {
  19.   echo "<tr>";
  20.   $j=count($Student[$x]);
  21.   for ($y=0;$y<$j;$y++)
  22.    {
  23.    echo ("<td>" . $Student[$x][$y] . "</td>");
  24.    }
  25.   echo "</tr>";
  26. }
  27. ?>
  28. </table>
  29. </BODY></HTML>
½Æ»s¥N½X
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

¹ï©ó³sÄòµù¼Ðªº¤Gºû°}¦C¨Ï¥Î±_ª¬for°j°é¥i¥H»´©öªº¸Ñ¨M¡A¦ý¬O­Y¹ï©ó«D³sÄòµù¼Ð©Î¦r¦êµù¼Ðªº°}¦C´N¦æ¤£³q¤F¡A¦¹®É­n§ï¥Î±_ª¬ªºforeach°j°é¤~¯à¸Ñ¨M¡A¨Ò¦p¿é¥X½d¨Òex04_12.php¤¤©Òªì©lªº°}¦C¡G
ex04_14.php
  1. <HTML>
  2. <HEAD>
  3. <TITLE>ex04_14</TITLE>
  4. </HEAD>
  5. <BODY>
  6. <table border=1>
  7. <?
  8. $Student=array(
  9. "¤p»x"=>array("a"=>100,2=>90,"b"=>80),
  10. "±oµØ"=>array(1=>60,"c"=>100,3=>70),
  11. "«F«Ê"=>array("d"=>90,2=>80,"e"=>90));

  12. foreach ($Student as $key=>$value)
  13. {
  14. echo "<tr>";
  15. foreach ($value as $key1=>$value1)
  16. {
  17. echo "<td>¤¸¯Àµù¼Ð: $key,$key1 ; ¤¸¯À­È: $value1 </td>";
  18. }
  19. echo "</tr>";
  20. }
  21. ?>
  22. </table>
  23. </BODY></HTML>
½Æ»s¥N½X

¹Ï4-12   ex04_14.php¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

        ÀR«ä¦Û¦b : ¯àµ½¥Î®É¶¡ªº¤H¡A¥²¯à´x´¤¦Û¤v§V¤Oªº¤è¦V¡C
ªð¦^¦Cªí ¤W¤@¥DÃD