Unit-1 Introduction to PHP
Topics:
1. Basic syntax,
2. defining variables and constants,
3. data types including arrays
4. operators and expressions
5. decision making statements
5. constructs for iterations (loop)
Basic syntax
----------------
1. How to write a PHP program? Give its basic syntax 2 Marks
Syntax / Grammar:
<?php
//code
?>
Example:
<?php
//PHP Program to display a small message
echo"Hello World";
?>
OUTPUT:
Hello World
2. What do you mean by PHP? Two marks
or
Full Form of PHP?
Ans PHP acronyms for "Personal Home Page". Sometimes, it also stands for HyperText
Preprocessor
It is a server side scripting language, open-source and object-oriented
language
3. Write some advantages and limitations of PHP? 3 Marks
4. What are the important tools required to write and execute PHP program? 3
Marks
Ans. Web Server (XAMPP/WAMP/LAMP/SAMP), Database (MySQL), PHP Parser, Editor
(Notepad)
5. Difference among XAMPP, WAMP, LAMP, SAMP
6. Write steps of parsing and executing a PHP Program. 3 Marks
7. Is PHP a case sensitive? 2 Marks
Yes, explain with example (Program)
defining variables and constants
1. Difference between variable and constant. 3 Marks V.Imp.
2. Difference between $ and $$ 2 Marks V.Imp
3. Explain the concept of magic constants in PHP with suitable example 3 Marks
4. What are the various datatypes used in PHP? Explain with suitable example. 3-
5 Marks V.Imp
5. Explain the need of expressions in PHP with suitable example. 5 Marks
V.Imp
6. What do you mean by scope of a variable. Explain the difference among local
variable vs Global vs Static variable with suitable example 5 Marks V.Imp
Ans Scope of a variable implies that it represents that part of a program from
which a variable is accessible or can be accessed/used
7. Explain the concept of Operators in PHP? 5-10 Marks
8. Distinguish between:
(i). = and ==
'=' Assignment operator
'==' check the equality
(ii). Bitwise Operator vs logical operators
(iii). Logical vs Shift operators
data types including arrays
operators and expressions
Already Done
decision making statements
5. constructs for iterations (loop)