You are on page 1of 3

Question 1: What do you understand by the term “Case Sensitive Language”?

Answer: PHP is a case sensitive language so all PHP keywords must be written in lower case letter. All PHP statement
must be end with a semicolon. Variables name declare start $ sign like ($salary or $name etc.)

Question How many code declaration blocks can be inserted in a PHP document?

Answer You can include as many PHP script section as you want within a document. However, when you include
multiple script section in a document, you must include a separate code declaration block for each section

Question Why does the PHP Group recommend that you use standard PHP script delimiters to write PHP code
declaration blocks?

Answer The standard method of writing PHP code declaration blocks is to use the script delimiters. A delimiter is a
character or sequence of characters used to mark the beginning and end of a code segment. When the scripting
engine encounters the script delimiters, it processes any code between the delimiters as PHP.

<?php

Statement;

?>

Question Identify the two types of comments available in PHP and indicate when each would be used.

Answer There are two types of comments you can add:

1. single line comment used for quick notes about complex code or to temporarily
disable a line of PHP code. You need to add // or # before the code.
Example:
//My comment goes here
#define ('TABLE_HEADING_WRITABLE', 'Writable');

2. multi-line comment used to comment out large blocks of code or writing


multiple line comments. You need to add /* before and */ after the code.
Example:

/*$Id$
Statements….
*/
?
What is difference between the echo and print statement in PHP?

There are same different between echo and print:

Echo-can output one or more string

Print-can only output one string, and returns always 1

Note; echo is marginally faster compered to print as echo does not return any value.
Write names list of PHP program structure.

PHP - Program Structure

A PHP program has the following form:

1. Delimiters

2. Variables and Constant

3. Functions

4. Statements & Expressions

5. Semi colon

6. Comments

Write a simple PHP program to print your BIODATA on the browser screen.

<?php public $phonenumber='03168922737';}


class student $a = new student();
{ public $name= 'ali'; echo $a->name;
public $rollnumber=55; echo "<br>";
public $fathername='muttaqi'; echo $a->fathername;
public $class='1 year'; echo "<br>";
public $section='1b'; echo $a->rollnumber;
public $technolgy='software engineering'; echo "<br>";
public $phonenumber='03168922737';} echo $a->class;

$a = new student(); echo "<br>";

echo $a->section;
echo "<br>";

echo "<br>";

echo $a->technolgy;

echo "<br>";

echo $a->phonenumber;

?>

You might also like