18 Questions
What is the output of the expression $x + $y
if $x = 10
and $y = 5
?
15
What is the purpose of the assignment operator +=
in PHP?
To assign a value to a variable
What is the output of the expression $x % $y
if $x = 10
and $y = 5
?
0
What type of operator is used to compare two values in PHP?
Comparison Operator
What is the output of the expression $x - $y
if $x = 10
and $y = 5
?
5
What is the purpose of the increment operator ++
in PHP?
To increment a value
What type of operators are used to perform mathematical operations in PHP?
Arithmetic Operators
Which operator is used to assign a value to a variable in PHP?
=
What type of operators are used to combine conditional statements in PHP?
Logical Operators
Which operator is used to check if two values are equal in PHP?
==
What type of operators are used to manipulate strings in PHP?
String Operators
Which operator is used to concatenate strings in PHP?
.
What is the purpose of the conditional operator?
To provide a shorthand way to write an if-else statement
What is the output of the expression $x && $y
if $x
is true
and $y
is false
?
bool(false)
What is the function of the ===
operator?
Check if two values are equal, and of the same type
What is the purpose of the string operator .
?
To concatenate strings
What is the output of the expression $name = "John"; $greeting = "Hello, " . $name . "!";
?
Hello, John!
What is the function of the ||
operator?
Logical OR
Test your understanding of PHP variables and operators. Learn how to declare and use global and local variables, and understand the different types of operators in PHP.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free