Software Lab Based on PHP



1.         Create a PHP page using functions for comparing three integers and print the largest number.
2.         Write a function to calculate the factorial of a number (non-negative integer). The function accept the number as an argument.
3.         WAP to check whether the given number is prime or not.
4.         Create a PHP page which accepts string from user. After submission that page displays the reverse of provided string.
5.         Write a PHP function that checks if a string is all lower case.
6.         Write a PHP script that checks whether a passed string is palindrome or not? ( A palindrome is word, phrase, or sequence that reads the same backward as forward, e.g., madam or nurses run)
7.         WAP to sort an array.
8.         Write a PHP script that removes the whitespaces from a string.
Sample string : 'The quick " " brown fox'
Expected Output : Thequick""brownfox
9.         Write a PHP script that finds out the sum of first n odd numbers.
10.     Create a login page having user name and password. On clicking submit, a welcome message should be displayed if the user is already registered (i.e.name is present in the database) otherwise error message should be displayed.
11.     Write a PHP script that checks if a string contains another string.
12.     Create a simple 'birthday countdown' script, the script will count the number of days between current day and birth day.
13.     Create a script to construct the following pattern, using nested for loop. *  
*  *  
*  * *  
*  * * *  
*  * * * *
14.     Write a simple PHP program to check that emails are valid.
15.     WAP to print first n even numbers.
16.     $color = array('white', 'green', 'red'') 
Write a PHP script which will display the colors in the following way :
Output : white, green, red,
    green
    red
    white
17.     Using switch case and dropdown list display a “Hello” message depending on the language selected in drop down list.
18.     Write a PHP program to print Fibonacci series using recursion.
19.     Write a PHP script to replace the first 'the' of the following string with 'That'.
Sample : 'the quick brown fox jumps over the lazy dog.'
Expected Result : That quick brown fox jumps over the lazy dog.

Comments