認識 [陣列變數]: (1) array的使用 (2) array的迴圈 (3) array的函數


練習題1: 索引式陣列的使用

Array ( [0] => 000 [1] => 100 [2] => 200 )
Array ( [0] => 000 [1] => 100 [2] => 200 [3] => 300 )
Array ( [0] => 000 [1] => 100 [2] => 200 [3] => 300 [8] => 800 )
Array ( [0] => 000 [1] => 100 [2] => 200 [3] => 300 [8] => 800 [9] => 500 )
Array ( [0] => 000 [1] => 100 [2] => 222 [3] => 300 [8] => 800 [9] => 500 )

練習題2: 關聯式陣列的使用

Array ( [Amy] => PHP [Mary] => WORD )
Array ( [Amy] => PHP [Mary] => WORD [Andy] => EXCEL )
Array ( [Andy] => EXCEL [Amy] => PHP [Mary] => WORD )
Array ( [Mary] => WORD [Amy] => PHP [Andy] => EXCEL )
Array ( [Amy] => PHP [Andy] => EXCEL [Mary] => WORD )
Array ( [Mary] => WORD [Andy] => EXCEL [Amy] => PHP )
Array ( [0] => EXCEL [1] => PHP [2] => WORD )

練習題3: 今天星期幾?

今天是星期2
Array ( [0] => 日 [1] => 一 [2] => 二 [3] => 三 [4] => 四 [5] => 五 [6] => 六 )
今天是星期二

練習題4: 依序顯示陣列變數的內容值

一週中有:星期日、星期一、星期二、星期三、星期四、星期五、星期六。
0櫃子裡有:EXCEL 的書。
1櫃子裡有:PHP 的書。
2櫃子裡有:WORD 的書。