1. K0032
05 Laboratory Exercise 2 *Property of STI
Page 1 of 1
Laboratory Exercise
PHP Functions and Arrays
Objectives:
At the end of the exercise, the students should be able to:
use functions in scripting PHP, and
write PHP scripts with arrays.
Materials:
Computer with the following installed software:
o WAMPSERVER 2.5
Apache
MySQL
PHP
o Internet Explorer 7 or higher, Google Chrome, Mozilla Firefox
o Any Text Editor
Flash drive
Procedures:
Exercise 1
1. Create a PHP script that will determine the Chinese Zodiac sign of a particular year. Below are the
12 Chinese Zodiac signs. Input can be from year 0000 to year 9999.
Note: Use function statement
1. Monkey
2. Rooster
3. Dog
4. Boar
5. Rat
6. Ox
7. Tiger
8. Rabbit
9. Dragon
10. Snake
11. Horse
12. Lamb
Sample input 1: 1986
Output: Tiger
Sample input 2: 2017
Output: Rooster
2. Create a PHP script using array that will output the following:
array name at index [0] is: apple
array name at index [1] is: banana
array name at index [2] is: orange
array name at index [3] is: pear