Recall & Review
beginner
What does the
null type represent in PHP?The
null type represents a variable with no value or an empty value. It means the variable is explicitly set to have no data.Click to reveal answer
beginner
How do you assign a
null value to a variable in PHP?You assign
null by writing: $var = null;. This means $var holds no value.Click to reveal answer
intermediate
What is the difference between an uninitialized variable and a variable set to
null in PHP?An uninitialized variable has never been given a value, while a variable set to
null has been explicitly assigned no value.Click to reveal answer
beginner
What does the function
is_null() do in PHP?The
is_null() function checks if a variable is null. It returns true if the variable is null, otherwise false.Click to reveal answer
beginner
Can a variable of any type be set to
null in PHP?Yes, in PHP any variable can be set to
null, which means it no longer holds its previous value.Click to reveal answer
What does
null mean in PHP?✗ Incorrect
null means the variable has no value at all, not zero, empty string, or false.
How do you check if a variable is
null in PHP?✗ Incorrect
is_null() returns true if the variable is null.
What happens if you assign
null to a variable that had a value before?✗ Incorrect
Assigning null removes the previous value from the variable.
Which of these is NOT true about
null in PHP?✗ Incorrect
null is different from false; false is a boolean, null means no value.
What is the result of
isset($var) if $var = null;?✗ Incorrect
isset() returns false if the variable is null.
Explain what the
null type means in PHP and how it is used.Think about how you tell PHP a variable has no data.
You got /4 concepts.
Describe how to check if a variable is
null and what happens when you assign null to a variable.Consider the functions and effects on the variable.
You got /3 concepts.