Starting from:

$25

CS213-Lab 4 Part 2 Solved

CS-213 : Lab 4 : PHP 1 part 2 statement


1.    Word frequency counter : (name of your file should be q2.php).

Take some words as input from the command line. Print the frequency count (number of occurrences) of each word sorted in alphabetical order.

Frequency count must be case-insensitive. (e.g. both ‘Hey’ and ‘hey’ would be counted under the same word ‘hey’)

Validate your input, using error handling mechanism in Question 1.

2.    Substring Frequency counter: (name of your file should be q3.php).

Take two words as input from the command line. Let us call first word as x and second word as y.

Count how many times y occurs as a substring in x, and the positions in x where it occurs it.

1

For example, on input x = “abacabab” and y = “ab” your output should be as follows:

3

0

4

6.

Validate your input, using error handling mechanism in Question 1.

2

More products