Font size
WorksheetsPHP - Syntax & Output
Total questions: 15
Worksheet time: 8mins
Which symbol for variables in PHP?
$
&
var()
Type VarNameWhich of the following is syntax for single-line comment in PHP?
#
/*
/* */
//
Which are PHP Arithmetic Operators?
+
/
*
All of the above
How do you create an array in PHP?
$cars = array["Blue", "Green", "Red"];
$cars = array ("Blue", "Green", "Red");
cars = {"Blue", "Green", "Red"};
cars[4] = {"Blue", "Green", "Red"};
Choose correct way to declare variable in PHP
var=1;
$var = 1;
define("var", 1);
$100var=1;
Identify the output
twinkle little star
Twinkle twinkle little star
Twinkle
little star
Identify Output
Kuala Selangor-KVKS 45
Kuala Selangor -KVKS 45
45-KVKS Kuala Selangor
45 KVKS Kuala Selangor
Which is an increment operator?
+
*
++
**
Which is the correct PHP tag?
<php … >
<?php … ?>
<?phpp … ?>
<!php … !>
Identify the output
2
3
8
9
Which one of these variables has an ILLEGAL name?
$my_Var
$my-Var
&my_Var
&my-Var
How do you write "Hello World" in PHP?
document.Write("Hello World");
echo "Hello World";
cout << "Hello World!";
System.out.println ("Hello World");
What is the CORRECT way to end a PHP statement?
}
,
;
What is the CORRECT way to create a function in PHP?
create myFunction()
function myFunction()
class MyFunction{};
What is the CORRECT way to add 1 to the $count variable?
$count =+1
$count++;
