Assignment 3
: Arrays and Strings
Practice Programs:
1. Write a PHP Script to define an array. Find the element from the array that matches the given value using the appropriate search function.
Answer :
2. Write a PHP script to count the total number of vowels (a,e, i,o,u) from the string. Show the occurrences of each vowel from the string.
Answer :
3. Write PHP program to perform
the following operations on Indexed Array:
a) Check the array element is
positive or negative
b) Calculate the average of array
elements
c) Calculate the sum of array
elements
Answer :
SET A:
1. Write PHP program to perform the following
operations on Indexed Array:
a) Union of two arrays
b) Traverse the array elements in
random order
Answer :
2. Write a PHP program to perform the
following operations on an associative array:
a) Display the elements of an
array along with the keys.
b) Display the size of an array
c) Delete an element from an
array from the given index.
d) Reverse the order of each
element’s key-value pair
e) Traverse the elements in an
array in random order.
Answer :
3. Write a PHP Script for the
following:
a) Declare and Display a
multidimensional Array.
b) Search and display a specific
element from a Multidimensional array.
Answer :
SET B:
1. Write a PHP script to perform
the following operations on string :
i) Compare string 2 with string3.
ii) Convert all the strings to
Upper case
iii) Convert all the strings to
Lowercase
Answer :
Subscribe to:
Post Comments
(
Atom
)