You are on page 1of 13

CONTENT

1.0 QUESTION 1 (Escaping The Character) ................................................................... 1

2.0 QUESTION 2 (Arithmetic Operator) ......................................................................... 3

3.0 QUESTION 3 (Concatenation) .................................................................................... 5

4.0 QUESTION 4 (Escaping the Character) .................................................................... 6

5.0 QUESTION 5 (IF ELSE).............................................................................................. 7

6.0 QUESTION 6 (While Loop)......................................................................................... 9

7.0 QUESTION 7 (Functions) .......................................................................................... 11

i
1.0 QUESTION 1 (Escaping The Character)

ANSWER :

1
REASON :

Notice how echo 5x5=$foo outputs $foo rather than replacing it with 25

Strings in single quotes ( ) are not interpreted or evaluated by PHP

This is true for both variables and character escape-sequences (such as \n or \\)

OUTPUT :

2
2.0 QUESTION 2 (Arithmetic Operator)

ANSWER :

3
REASON :

$a - $b // subtraction
$a * $b // multiplication
$a / $b // division
$a += 5 // $a = $a+5 Also works for *= and /=

OUTPUT :

4
3.0 QUESTION 3 (Concatenation)

ANSWER :

REASON :

Use a period to join strings into one.

OUTPUT :

5
4.0 QUESTION 4 (Escaping the Character)

ANSWER :

REASON :

If the string has a set of double quotation marks that must remain visible, use the \
[backslash] before the quotation marks to ignore and display them.

OUTPUT :

6
5.0 QUESTION 5 (IF ELSE)

ANSWER 1:

OUTPUT 1:

7
ANSWER 2:

OUTPUT 2:

REASON :

Control Structures: Are the structures within a language that allow us to control the
flow of execution through a program or script.
Grouped into conditional (branching) structures (e.g. if/else) and repetition
structures (e.g. while loops).

8
6.0 QUESTION 6 (While Loop)

ANSWER :

9
REASON :

While (condition)
{
Statements;
}

OUTPUT :

10
7.0 QUESTION 7 (Functions)

ANSWER :

11
REASON :

Functions MUST be defined before then can be called


Function headers are of the format

Note that no return type is specified

Unlike variables, function names are not case sensitive (foo() == Foo() ==
FoO())

OUTPUT :

12

You might also like