PHP Basics Programs (Variables, Datatypes, Operators)

Back To PHP Index


1. php program to print hello world - Code
2. php program to input an integer (or number) and display its value - Code
3. php program to input two numbers or integers and display their values - Code
4. php program to input two numbers and find their sum - Code
5. php program to input three numbers and find their sum - Code
6. php program to input two numbers and find the difference between them - Code
7. php program to input two numbers and find their product - Code
8. php program to input two numbers and find their quotient (division) - Code
9. php program to input two numbers and find their remainder - Code
10. php program to enter a character and display its value - Code
11. php program to input a float value (number with decimal point ) - Code
12. php program to add two decimal point values - Code
13. php program to input two decimal point numbers and display difference between them - Code
14. php program to input two float (decimal point) values and find their product - Code
15. php program to input two float (decimal point) values and find their quotient - Code
16. php program to input principal, rate of interest and time and compute simple interest - Code
17. php program to input length and breadth of rectangle and find area of rectangle - Code
18. php program to input length and breadth of rectangle and find perimeter of rectangle - Code
19. php program to input side of square and compute area of square - Code
20. php program to input side of square and compute perimeter of square - Code
21. php program to input base and height of right angled triangle and find area of right angled triangle - Code
22. php program to input radius of circle and find area of circle - Code
23. program to input radius of circle and find circumference of circle - Code
24. php program to demonstrate increment(++) operator , i++ is same as i=i+1 - Code
25. program to demonstrate deccrement(--) operator , i-- is same as i=i-1 - Code
26. php program to demonstrate (+=) operator, a+=2 is same as a=a+2 - Code
27. php program to demonstrate (-=) operator, a-=2 is same as a=a-2 - Code
28. php program to demonstrate (*=) operator, a*=2 is same as a=a*2 - Code
29. php program to demonstrate (/=) operator, a/=2 is same as a=a/2 - Code
30. php program to demonstrate (%=) operator, a%=2 is same as a=a%2 - Code
31. php program to input price of an item from user and calculate discount as 10 percent on the price - Code
32. php program to find volume of box based on width,depth and height - Code
33. php program to demonstrate ternary operator or conditional operator, displays 'p' if marks>=40 else displays 'f' - Code