PHP Assignment

Sub: PHP

Question Bank



1. Answer the following                                                                               

1.What is  array ?Explain the types of array.

2.What is variable.How to declare it?

3.Explain any four built functions for Array with example.

4.Explain for loop and foreach loop

5.Explain a comments in PHP

6.Explain Indexed array and associative array  With example

7.What is variable in PHP ?Explain with its scope with example?

8.Explain asort(),ksort(),arsort(),krsort() with example.

9.Explain echo and Print Statements

10.What are the difference between for loop and foreach loop



2. Write a PHP program  

1.Write PHP script to define an interface which has methods area(), volume(). Define constant PI. Create a class cylinder which implements this interface and calculate area and volume.           

2.Write a PHP script for the following: Design a form to accept the details of 5 different items, such as item code, item name, units sold, rate. Display the bill in the tabular format. Use only 4 text boxes. (Hint : Use of explode function.)                                                                                                  

3.Derive a class square from classRectangle. Create one more class circle. Create an interface with only onemethod called area().Implement this interface in all the classes. Include Appropriate data members and constructors in all classes. Write a PHP program to accept details of a square, circle and rectangle and display the area.

4.Implement calculator to convert distances between (both ways) miles and kilometers. One mile is about 1.609kilometres. User interface (distance.html) has one text-input, two radio-buttons,submit and reset -buttons. Values are posted to PHP-script (distance.php) which calculates the conversions according the user input. 

PHP

 Assignment 1

Explain types of Array with Example

Explain Array Sort Function With Example

Explain in_array () and is_array() with Example.


 Assignment 2

 

1. Write a functions of String

  i. strlen()

  ii. str_repeat()

  iii. substr()

  iv. str_word_count()

  v. addslashes()

 

2. Write a functions of Array.

  i. array_slice()

  ii. array_shift()

  iii. array_push()

  iv. array_pop()

  v. shuffle ()

 

3. Explain PHP Class and Object with example.