List of PHP basic programs with examples

PHP( Hypertext Preprocessor) is a server scripting language, and It is a powerful tool for making interactive and dynamic Web-pages. This scripting language is a usually used, free, and efficient alternative to competitors such as Microsoft’s ASP.

  1. Write a PHP script to display ‘Hello World!’
  2. Create a HTML form that accept the user name and display the name using php
  3. Write a PHP script to get the client IP address
  4. Write a simple PHP browser detection script
  5. Write a PHP script, which changes the color of the first character of a word
  6. Write a PHP script to redirect a user to a different page
  7. Write a simple PHP program to check that email id is valid or not
  8. Write a PHP script to display string, values within a table
  9. Write a PHP function to test whether a number is greater than 30, 20 or 10 using ternary operator
  10. Write a PHP program to swap two variables
  11. Write a PHP program to check if a number is an Armstrong number or not
  12. Write a PHP program to convert word to digit
  13. Write a PHP program to remove duplicates from a sorted list
  14. Write a PHP program to compute the sum of the prime numbers less than 200
  15. Write a PHP program to print out the multiplication table upto 5*5
  16. Write a PHP program to compute the sum of the digits of a number
  17. Write a PHP program that multiplies corresponding elements of two given lists

Leave a Comment