0% found this document useful (0 votes)
6 views

PHP Basic PS

Uploaded by

22x026
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

PHP Basic PS

Uploaded by

22x026
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

PSG COLLEGE OF TECHNOLOGY

DPARTMENT OF APPLIED MATHEMATICS AND COMPUTATIONAL SCIENCES

BSc. COMPUTER SYSTEMS DESIGN

FIFTH SEMESTER

21XA02 – OPEN SOURCE SOFTWARE

PROBLEM SHEET –PHP (Basic, echo, print and operator and conditional statement)

Date: 26 June 2024 Due: 03 July 2024

1. Write a PHP script to get the PHP version and configuration information.
<?php
phpinfo( );
?>
2. Write a program to print “Hello World” using echo only?
3. Write a program to print “Hello PHP” using PHP variable?
4. Write a program to print “Welcome to the PHP World” using some part of the text in
variable & some part directly in echo.
5. Write a program to print two PHP variables using single echo statement.
6. Write a PHP program to check whether a number is positive, negative or zero.
7. Write a PHP script which displays all the numbers between 200 and 250 that are divisible by
4.
Expected Output : 200,204,208,212,216,220,224,228,232,236,240,244,248
8. Write a PHP program to compute the sum of the two given integer values. If the two values
are the same, then returns triple their sum
9. Write a PHP program which iterates the integers from 1 to 50. For multiples of three print
"CAR" instead of the number and for the multiples of five print "BUS". For numbers which are
multiples of both three and five print "CARBUS"
10. Write a program to count 5 to 15 using PHP loop (while and do-while)
11. Write a program to calculate factorial of a number using for loop in PHP.
12. Write a PHP program using nested for loop that creates a chess board.
13. Create a simple HTML form and accept the user name and display the name through PHP
echo statement.
14. Create an HTML form to perform sum or addition of two numbers in PHP programming.
15. Create an HTML form to read a data such as roll number, name, 5 subject marks to check
student grade based on the marks using if-else statement.
Conditions:

 All the subjects marks should be >50 means result is “PASS”, otherwise “FAIL”
 If marks are 90% or more, grade will be First Division.
 If marks between 70% to 89%, grade will be Second Division.
 If marks between 50% to 69%, grade will be Third Division.
16. Create an HTML form to read day number (1 to 7) 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
17. Create an HTML form to calculate Electricity Bill preparation. Read the data from user is
consumer number, consumer name, and consumed unit
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

18. Write a PHP program to check if a person is eligible to vote or not.


Condition
Minimum age required for vote is 18.
19. Write a PHP script to display string, values within a table.
Note : Use HTML table elements into echo.
Expected Output :

20. Create a simple HTML form and accept the user name and display the name through PHP
echo statement.
21. Create employee table and perform net salary calculation.
Input Fields: Employee Number, Employee Name, Gender, Date of birth, Designation,
Basic pay
Calculation: HRA is 10% of BP, PF is 1000, net salary is (BP+HRA) -PF

You might also like