Font size
WorksheetsPHP
Total questions: 23
Worksheet time: 14mins
Which tag is used for php
<?php
?>
<style>
<php ?>
<php
/php>
<?php
function add()
{
global $a=10;
echo $a;
}
add();
$a+=10;
?>
Output is?
10
15
20
30
<?php
echo str_replace("world", "Dolly", "Hello world!");
?>
Outputs?
Hello world
Hello Dolly
Error
Hello
What does PHP stands for?
PHP: Hypertext Preprocessor
Private Home Page
Personal Hypertext Processor
Which among the following is the correct delimiters that surround PHP server scripts?
<?php>...</?>
<script>...</script>
<?php...?>
<&>...</&>
How do you write "Hello World" in PHP
Document.Write("Hello World");
"Hello World";
echo "Hello World";
All variables in PHP start with which symbol?
$
!
&
What is the correct way to add 1 to the $count variable?
$count =+1
$count++;
++count
count++;
What will this code do?
<html>
<head>
<title>My First PHP Page</title>
</head>
<body>
<?php
echo "Hello World!";
?>
</body>
</html>
Print the date
Print the time
Print 'Hello World'
None of the above
Complete the following :
<? PHP
_____ "Hi";
?>
echo
php
/html
Each PHP statement must end with a semicolon.
Which symbol is this?
:
,
;
#
Which of the following is the correct syntax?
echo "(<p> Hello.</p>);
echo (<p>' Hello.'</p>);
echo "<p> Hello.</p>";
This code below is missing some simple PHP. Complete the Script
<? php
echo "Hi there, I'm learning some cool PHP Jazz";
_____
<html>
echo
?>
</html>
A PHP variable must start with ?
_
;
$
<
Variable names are case-sensitive.
TRUE
FALSE
Is variable assigned correctly ?
$12num;
TRUE
FALSE
Is variable assigned correctly
$_namasurname;
TRUE
FALSE
<?php
$name = 'John';
$age = '25';
echo $name;
?>
What are the variable ?
<?php
?>
$name
$age
John
25
echo
$name;
A variable declared outside a function has a global scope
TRUE
FALSE
<?php
$t = date("H");
if ($t < "10") {
echo "Have a good morning!";
} elseif ($t < "20") {
echo "Have a good day!";
} else {
echo "Have a good night!";
}
If the current hour is 14, what is an output?
Have a good day!
Have a good night!
Have a good morning
Error
What is the output for the following
<?php
$x = 1;
while($x <= 5) {
echo "The number is: $x <br>";
$x++;
}
?>
0
1
2
3
4
1
2
3
4
5
The number is 1
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
What should be added to output $i as long as $i is less than 6.
$i = 1;
________________($i < 6) {
echo $i;
$i++;
}
while
for
if
foreach
Create a loop that runs from 0 to 9.
____($i = 0; $i < 10; ____) {
echo $i;
}
(a)
