KEMBAR78
Web Technology Unit-1 - 2 Marks | PDF | Php | Data Type
0% found this document useful (0 votes)
11 views3 pages

Web Technology Unit-1 - 2 Marks

The document provides a comprehensive overview of PHP, covering its definition, unique features, and various functionalities such as echo statements, comments, variables, and data types. It also lists operators used in PHP, including arithmetic, comparison, and logical operators, as well as the concept of operator precedence. Additionally, it explains the difference between == and === operators in PHP.

Uploaded by

dhanesh.mukkam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Web Technology Unit-1 - 2 Marks

The document provides a comprehensive overview of PHP, covering its definition, unique features, and various functionalities such as echo statements, comments, variables, and data types. It also lists operators used in PHP, including arithmetic, comparison, and logical operators, as well as the concept of operator precedence. Additionally, it explains the difference between == and === operators in PHP.

Uploaded by

dhanesh.mukkam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

III BCA - WEB TECHNOLOGY

UNIT 1- 2 MARK QUESTIONS


1. What is PHP?
PHP stands for "PHP: Hypertext Preprocessor" (originally: Personal Home Page). It is a
server-side scripting language used to create dynamic web pages and web applications.
2. List out the unique features of PHP.
 Performance
 Portability
 Ease of use
 Open source
 Community support
 Third party applications support

3. What is the use of echo statement in PHP?


The echo statement in PHP is used to display output to the browser.

Eg: echo "Hello, world!";

4. How comments are written in PHP?


Single-line comments are preceded by the //
Multiline comments must be enclosed within a /* ... */ comment block.

Eg:

<?php
// a single-line comment
?>

<?php
/* a multi-line
comment
block */
?>

5. List out escape characters in PHP.


Escape characters are used to display non graphic characters

Escape character Meaning


\n New line
\t New tab
\r Carriage return
\” Double quote
\’ Single quote

6. Define variable.
Variable is a container to hold data. It is named memory location.
Eg: $num, $_name;

7. List variables naming rules in PHP


 Must start with a $ sign
 Variable name must start with a letter or underscore(_)
 After the first letter, letters, digits or underscore can be used
 Other characters are not allowed

8. How variables can be destroyed?


unset() function can be used to destroy variables in PHP
Eg: unset($name);

9. What is the use of var_dump() function in PHP?


var_dump() function is used to display information about of a variable.
Eg:
<?php
$x=10;
var_dump($x);
?>
Output: int (10)

10. List data types in PHP.


 Boolean
 Integer
 Float
 String
 NULL

11. What are constants in PHP?


Constants are fixed values that cannot change during program execution. It is defined using
„define‟ keyword
Eg: define(„PI‟,3.141692);

12. List out arithmetic operators used in PHP

Operator Description
+ Add
- Subtract
* Multiply
/ Divide
% Modulus

13. List out comparison(relational) operators used in PHP

Operator Description
== Equal to
!= Not equal to
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
=== Equal to and of the same type
14. List out logical operators used in PHP

Operator Description
&& AND
|| OR
! NOT

15. Which operastor is used as concatenating operator in PHP?


. operator is used to concatenate(join) strings in PHP.
Eg:
<?php
$fName= “Virat” ;
$lName= “Kohli” ;
echo $fName.“ ”.$lName;
?>
Output: Virat Kohli

16. What is operator precedence?


Operator precedence is the order in which operation is performed.
Operator precedence in PHP
++ --
*/%
+-.
< <= > >=
== != === !==
&&
||
= += -= *= /= %=

17. Differentiate == and === operator


== operator compares two values and returns true if both values are equal without considering its
data type.
=== operator compares two values and returns true only if two values are equal and are of the same
data type.

<?php
$x = (boolean) 1;
$y = (integer) 1;
// returns true
echo ($x == $y);
// returns false
echo ($x === $y);
?>

You might also like