You are on page 1of 2

UNIT 4: Open Book Assignment

1) What is the difference between indexed and associative array? Illustrate how
to define and access elements of indexed array and associative array through
examples.

2) Identify appropriate PHP function mentioned below:


 Function to determine whether a variable is NULL.
 Function to destroy a given variable.
 Function to removes whitespace from the end of a string.
 Function that returns true if a given key is actually present in a given array.
 Function that determines element exist in an array and takes two parameters.

3) What is the use of the $_REQUEST variable? Describe through an example.

4) What the difference between for and Foreach loop in PHP? Describe through
examples.

5) Display the result by using appropriate string function as mentioned below:


$str= "The quick brown fox jumps over the lazy dog";
a. Count total number of words in the above sentence.
b. Search the word quick if appears in the above string then return
position.
c. Replace the color brown to black in the above string.
d. Fetch the words fox jumps over and store in to $partstr.
e. Remove fox from $partstr.

6) Discuss the following with example


a. fread()
b. file()
c. file_get_contents
d. fgets()
e. fwrite()
f. file_put_contents()
7) Write types of $_SERVER attributes and values. Display all values with its
elements mentioned.

8) Write short note for following functions used in PHP with an example:
a. srand
b. ceil
c. mktime
d. sprint

You might also like