PHP Programs

Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.


Program 1: Write a function to calculate the factorial of a number (non-negative integer). The function accept the number as an argument.


Program 2: Write a program to check whether the given number is prime or not.


Program 3: Write a PHP program to check whether a user entered number is even or odd.


Program 4: Write a PHP program to take 3 numbers from user and find the greatest number.


Program 5: Create a PHP page which accepts string from user. After submission that page displays the reverse of provided string.


Program 6: Write a PHP function that checks if a string is all lower case.


Program 7: Create a PHP program using functions for comparing three integers and print the largest number.


Program 8: Write a PHP program that checks whether a passed string is palindrome or not.


Program 9: Write a PHP program to sort an array.


Program 10: Write a PHP program that removes the whitespaces from a string.


Program 11: Write a PHP program that checks if a string contains another string.


Program 12: Write a PHP program that finds out the sum of first n odd numbers.


Program 13: Write a program delete an element from the array ($num = array(2 ,4 ,6 ,8 ,10)).


Program 14: Write a PHP program using a loop to add all the integers 0 and 35 and display the sum.


Program 15: Write a PHP program which will count the "d" characters in the text "tutorial.duniya".


Program 16: Write a PHP program to get the first element of the array($color = array(4=>'white', 6=>'green', 11=>'red')).


Program 17: Write a PHP program check a function to reverse a string.


Program 18: Write a PHP program to calculate the difference between two dates using PHP OOP approach.


Program 19: Write a PHP program to a convert a string to Date and DateTime.


Program 20: Write a PHP program to split the given string.


Program 21: Write a PHP program to convert the value of a PHP variable to string.


Program 22: Write a PHP program to check if a string contains a specific string.


Program 23: Write a PHP program to extract the user name from the following email ID.


Program 24: Write a PHP program to get the last three characters of a string.


Program 25: Write a PHP program to format values in currency style.


Program 26: Write a PHP program to generate simple random password [do not use rand() function] from a given string.


Program 27: Write a PHP program to find first character that is different between two strings.


Program 28: Write a PHP program to print the sum of digits of an integer.


Program 29: Write a PHP program to reverse a number.


Program 30: Write a PHP program to swap two numbers.


Program 31: Write a PHP program to print all prime numbers between 1 to 100.


Program 32: Write a PHP program to calculate area of rectangle.


Program 33: Write a PHP program to convert Celsius into Fahrenheit.


Program 34: Write a program to copy all the elements of one array into another array.


Program 35: Write a program to print the duplicate elements of an array.


Program 36: Write a program to print the elements of an array in reverse order.


Program 37: Write a program to print the elements of an array present on even position.


Program 38: Write a program to print the elements of an array present on odd position.


Program 39: Write a program to print the largest element present in an array.


Program 40: Write a program to sort the elements of an array in descending order.


Program 41: Write a program to count the total number of punctuation characters exists in a string.


Program 42: Write a program to count the total number of vowels and consonants in a string.


Program 43: Write a program to replace lower-case characters with upper-case and vice versa.


Program 44: Write a program to replace the spaces of a string with a specific character.


Program 45: Write a program to count the total number of characters in a string.


Program 46: Write a program to count the total number of words in a string.


Program 47: Write a Program to find the duplicate words in a string.


Program 48: Write a program to find the largest & smallest word in a string.


Program 49: Write a program to print smallest and biggest possible palindrome word in a given string.


Program 50: Write a program to swap two string variables without using third or temp variable.