PHP Programs List 1
1. Write a PHP program to print sum of digits. Input: 235
2. Write a PHP program to print number is even or odd. Input: 23
3. Write a PHP program to check prime number. Input: 17
4. Write a PHP program to print table of a number. Input: 2 Output: 2 4 6 8 10 12 14 16
18 20
5. Write a PHP program to print factorial of a number. Input: 7
6. Write a PHP program to check Armstrong number. Input: 371
7. Write a PHP program to check Palindrome number. Input: 121
8. Write a PHP program to print Fibonacci series without using recursion and using
recursion Input: 11
9. Write a PHP program to reverse given number. Input: 234
10. Write a PHP program to reverse given string. Input: amit
11. Write a PHP program to swap two numbers with and without using third variable.
12. Write a PHP program to find area of triangle.
13. Write a PHP program to find the area of rectangle.
14. Write a PHP program to find if the given year is leap year or not.
15. Write a PHP program to print even no.s upto 100.
16. Write a PHP program to find square root of no.
17. Write a PHP program to print indexed and associative array elements.
18. Write a PHP program to print vertical and inverted pyramid of characters e.g. *.
19. Write a PHP program to print day of week. E.g. Input 1 Output – Monday
20. Write a PHP program to create pdf file containing your name, roll no., Email, mobile no.
etc.
PHP Programs List 2
1. Write a simple PHP program to set Cookies & read it.
2. Write a PHP program to create session & assign session values & read it.
3. Write a PHP program to create a form with fields name, mobile no., and email and
validate data fields.
4. Write a PHP program to create form of registration using Form controls -Text box, List
Box, Combo box.
5. Write a PHP program to create form of registration using Form controls- Text box, check
box, Hidden Field.
6. Write a PHP program to create web page having multiple forms and different files for
processing of PHP file.
7. Write a PHP program to create web page having multiple forms and single file for
processing of PHP file.
8. Write a PHP program to create web page having a form and calls same file for processing
of PHP file.(PHP_Self)
9. Write a PHP program to create form of registration using Form controls Text Box, Radio
button.
10. Write a PHP program for introspection (check object characteristics such as class name,
methods by using function available in PHP )
11. write a PHP program for introspection (check object characteristics such as its parent
class, interfaces by using function available in PHP )
12. write a PHP program for introspection (check object characteristics such as its classes by
using function available in PHP )
13. Write a PHP program to print data in serialize & unserialize form.
14. Write a PHP program to create class employee assign values using constructor & use
destructor.
15. Write a PHP program to create shape class & rectangle class using inheritance print its
properties.
16. Write a PHP program to create shape class & triangle class using inheritance print its
properties.
17. Write PHP programs to demonstrate creation of shallow and deep clone of an object.
18. write a PHP program to create and resize image.
19. Write PHP program to demonstrate srpos(), str_replace(), strlen() String Functions.
20. Write PHP program to greet user based on current time. E.g. before 12 pm: Good
Morning, 12-5pm: Good Afternoon, 5-9pm: Good Evening