Lab Report Assignment:

  1. Write a program to print “Hello World” using echo only.
    Conditions:
     You cannot use any variable.
  2. Write a program to print “Hello PHP” using php variable.
    Conditions:
     You cannot use text directly in echo but can use variable.
  3. Write a program to print “Welcome to the PHP World” using some part of the text in variable & some part directly in echo.
    Conditions:
     You have to use a variable that contains string “PHP World”.
  4. Write a program to print 2 php variables using single echo statement.
    Conditions:
     First variable have text “Good Morning.”
     Second variable have text “Have a nice day!”
     Your output should be “Good morning. Have a nice day!”
     You are allowed to use only one echo statement in this program.
  5. Write a PHP program to check if a person is eligible to vote or not.
    Conditions:
     Minimum age required for vote is 18.
     You can use Decision Making Statements.
  6. Write a PHP program to check whether a number is positive, negative or zero.
    Conditions:
     You can use if else conditions.
     You should use appropriate PHP Operators.
     Also check if it not a numeric value.
  7. Write a program to check student grade based on the marks using if-else statement.
    Conditions:
     If marks are 60% or more, grade will be First Division.
     If marks between 45% to 59%, grade will be Second Division.
     If marks between 33% to 44%, grade will be Third Division.
     If marks are less than 33%, student will be Fail.
  8. Write a PHP program to calculate electricity bill using if-else conditions.
    Conditions:
    For first 50 units – Rs. 3.50/unit
    For next 100 units – Rs. 4.00/unit
    For next 100 units – Rs. 5.20/unit
    For units above 250 – Rs. 6.50/unit
  9. Write a program to show day of the week (for example: Monday) based on numbers using switch/case statements.
    Conditions:
     You can pass 1 to 7 number in switch
     Day 1 will be considered as Monday
     If number is not between 1 to 7, show invalid number in default
  10. Write a Program to display count, from 5 to 15 using PHP loop as given below.
    Conditions:
     You can use “for” or “while” loop
     You can use variable to initialize count
  11. Write a program to find average of first ten natural numbers using for loop.
  12. Write a program using for loop to add all the integers between 0 and 10 and display the total.
  13. Write a program to calculate factorial of a number using for loop in PHP.
  14. Write a PHP program using nested for loop that creates a chess board.
    Conditions:
     You can use html table having width= “400px” and take “30px” as cell height and width for check boxes.
  15. Write a PHP function that accepts list of countries and a search value as parameters and check whether the search value is in the list or not.
  16. Write a PHP program to print the following List in array and display as follows:
    a. Bachelor in Information Management
    b. Bachelor in Business Administration
    c. Bachelor in Business Studies
  17. Write a PHP program to create a multidimensional array that holds the cities of districts in Kathmandu valley such as Kathmandu (Newroad, Durbar Marg, Thamel), Lalitpur (Patan, Jawlakhel, Kupondole), Bhaktapur (Durbar square, Suryabinayak). Then display the contents of array.
  18. Write a program to print the following table. (Use array to store data)

-Report must be submitted by 28th July, 2024

Leave a Comment

Your email address will not be published. Required fields are marked *