The document lists 20 experiments for a lab covering a range of programming concepts and tasks including:
1) Basic HTML tags, programs to check even/odd numbers, calculate discounts, and find largest of three numbers.
2) Programs to calculate digit sums, Fibonacci series, and count positive/negative/zero numbers entered.
3) Functions to count word occurrences, implement a basic calculator, swap strings by value and reference, and perform operations on array elements.
4) Programs to display country-city data in a table, check character subsets between strings, write/append/display files, and implement a login form redirecting to pages.
5) A PHP class to represent
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
370 views
PHP Lab Program
The document lists 20 experiments for a lab covering a range of programming concepts and tasks including:
1) Basic HTML tags, programs to check even/odd numbers, calculate discounts, and find largest of three numbers.
2) Programs to calculate digit sums, Fibonacci series, and count positive/negative/zero numbers entered.
3) Functions to count word occurrences, implement a basic calculator, swap strings by value and reference, and perform operations on array elements.
4) Programs to display country-city data in a table, check character subsets between strings, write/append/display files, and implement a login form redirecting to pages.
5) A PHP class to represent
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
List of Experiments for the Lab
1. Introduction to basic HTML tags.
2. Write a Program to check and print whether a given number is even or odd. 3. Write a program to compute net amount from the given quantity purchased and rate per quantity. Discount @10% is allowed if the quantity purchased exceeds 100. 4. Write a program to find largest among three numbers using ternary operators. 5. Write a program to print sum of digits of a given number. (using while loop) 6. Write a program to print Fibonacci series upto a given number. 7. Write a program to enter numbers till the user wants. At the end it should display the count of positive, negative and zeros entered. (Using do-while loop) 8. Write a function countWords ($str) that takes any string of characters and finds the Number of times each word occurs. You should ignore the distinction between capital and lowercase letters. 9. Create a form with one text field and submit buttons for string length, string reverse and uppercase, lowercase, string replace. Display the result accordingly. 10. Write a Menu-Driven program to implement a calculator which performs only addition, subtraction, multiplication and division. The operation should happen based on the user choice. (use switch case) 11. Write a function to swap two string values using call by value and call by references. 12. Write a program that will accept an array of integers as input, and output an array where for each item in the source array, the new array will perform the following operations: For even numbers divide by 2 For odd numbers multiply by 3 13. Create an associative array using the countries as keys, the cities as values and transform it into 2-dimensional array and display the data as a table. 14. Given two strings A and B, how would you find out if the characters in B were a subset of the characters in A? 15. Write a program that create a file and write contents to it and display it. Then append some data to it. 16. Create a login form with two text fields called “login” and “password”. When user enters “Galgotias” as a user name and “university” as a password it should be redirected to a Welcome.HTML page or to Sorry.HTML in case of wrong username/password. 17. Write a PHP program using Java Script to convert the decimal number to its binary equivalent. You must use a form to accept the number from the user. 18. Write a PHP code that define class Student with attributes RollNo, Name, Branch, and Year, create 3 instances of it, sets the values of each instance appropriately and print the values of all attributes. 19. Write a function calculateAverage () which takes four int arguments which are marks for four courses in the semester and returns their average as a float. The calculateAverage () function should take only valid range for marks which is between 0 - 100. If the marks are out of range is should throw an OutOfRangeException and handles it. 20. Create a form with a text box asking to enter your favorite city with a submit button when the user enters the city and clicks the submits button another php page should be opened displaying “Welcome to the city”.