NEW
Font size
WorksheetsPHP Initial Evaluation
Total questions: 20
Worksheet time: 10mins
What type of language is PHP
Client Side
Server Side
Browser Side
Web Side
$colours = array("black", "blue", "Red", "Green") - How do I access "Red" ?
$colours[0];
$colours[2];
$colours[1]
$colours[3];
How do I print out the values of the variable "name" ?
$name;
include $name;
echo $name;
echo $name
function sayMyName(name) {} ; - How do I call tat function
sayMyname();
$sayMyName;
$sayMyName();
sayMyName("John");
$a = 4 ; $b = 6; $c = $a + $b; What is the value of variable "c" ?
6
8
10
None
PHP scripts are enclosed within ___
<php> . . . </php>
<?php . . . ?>
?php . . . ?php
Find the output
<?php
$x = 5;
{ $x = 10;
echo $x;
}
echo $x;
?>
105
510
1010
find the output
<?php
$x = 1;
$x += 1;
echo $x;
?>
2
1
0
Write a correct syntax to include a file named "footer.php".
include ("footer.php");
import("footer.php");
required("footer.php");
export("footer.php");
Create a session variable named "favcolor".
$session["favcolor"] = "green";
$_SESSION["favcolor"] = "green";
$_SESSION["favcolor"] ["green"];
$SESSION["favcolor"] ="green";
How do you get information from a form that is submitted using the "get" method?
Request.QueryString;
Request.Form;
$_GET[];
When using the POST method, variables are displayed in the URL:
True
False
What is the correct way to create a function in PHP?
new_function myFunction()
function myFunction()
create myFunction()
Which superglobal variable holds information about headers, paths, and script locations?
$_GET
$_SESSION
$_SERVER
$GLOBALS
What is a correct way to add a comment in PHP?
<comment>...</comment>
*\...\*
/*...*/
<!--...--->
How do you create an array in PHP?
$cars = array("Volvo","BMW","Toyota");
$cars = "Volvo","BMW","Toyota";
$cars = array["Volvo","BMW","Toyota"];
Which operator is used to check if two values are equal and of same data type?
=
==
===
!=
Which of the following is the correct way of defining a variable in PHP?
$variable name = value;
$variable_name = value;
$variable_name = value
$variable name as value;
Which of the following is the use of strlen() function in PHP?
The strlen() function returns both value and type of string
The strlen() function returns the length of string
The strlen() function returns the type of string
The strlen() function returns the value of string
When concatenating strings, you use what symbol in PHP?
A comma ,
A plus sign +
a hyphen -
a full stop .
