You are on page 1of 1

Task for 09-03-2023

Develop the PHP scripts to display the following:

1. Factorial calculator based on $_REQUEST input and while loop. the factorial of a
number n is simply the product of all the numbers between n and 1. Validate against
negative and zero as input. So, for example, the factorial of 4 is 4 *3 * 2 * 1 = 24.

2. Using superglobal variable $_SERVER, display name of the running server, server
protocol, server software, user agent, current running script, gateway interface, and
remote address.
Modify above concept and print all the super global $_SERVER all information using
loop concept

3. Create a numeric index array of string (student names) and perform


a) Unset operation for alternate values.
b) Perform ascending and descending sort in the array
c) Perform current, prev, next and reset element on the array
d) Perform push and pop on the same array

4. Create an associative array with name and marks for the students and perform
a) Display using functions list of key and values
b) Add new key/value pair in the existing array.
c) Perform each function and display all the elements
d) Use foreach and perform ASORT, ARSORT, KSORT, KRSORT sorting and
display elements

5. Create a file program to display use of


I. Function that read content of file and also returns content Size of a file. Display
appropriate error, if file does not exist in current directory. Close the file already
read.
II. Open a file with write in a file. Append additional content after exiting content.
III. Lock the file using shared and executive lock
IV. Check if the file exists in current server directory. If yes then read the first five
lines of the file and display the content and display single characters from the
file.
V. Read the file content until the file Pointer reached End-of-file then display the
content.
 Execute following modes to  Display the usage of following
identify each separate functionality functions
i. r and r + i. file
ii.w and w+ ii. file_get_contents
iii. a and a+ iii. file_put_contents
iv. x+

You might also like