Which of the following is a valid data type in PHP?
A
number B
float C
character D
letter
Analysis & Theory
`float` is a valid PHP data type for decimal numbers. `number` and `character` are not PHP data types.
Which data type does the value `true` belong to in PHP?
A
integer B
boolean C
string D
float
Analysis & Theory
`true` is a boolean data type in PHP.
What is the output of `gettype(5);` in PHP?
A
"integer" B
"float" C
"string" D
"boolean"
Analysis & Theory
`gettype(5);` returns `'integer'` because 5 is an integer.
Which of the following is NOT a scalar data type in PHP?
A
integer B
string C
array D
float
Analysis & Theory
An `array` is not a scalar type. Scalar types include `integer`, `float`, `string`, and `boolean`.
Which data type represents a collection of key-value pairs in PHP?
A
array B
object C
boolean D
integer
Analysis & Theory
An `array` is used to store multiple values in one variable, often as key-value pairs.
What is the output of `var_dump(NULL);`?
A
string(NULL) B
null(NULL) C
NULL D
object(NULL)
Analysis & Theory
It outputs `NULL`, representing the absence of a value in PHP.
Which data type is used to represent complex objects in PHP?
A
object B
array C
integer D
float
Analysis & Theory
The `object` data type is used to represent instances of classes.
What is the data type of the value `3.14` in PHP?
A
integer B
float C
string D
boolean
Analysis & Theory
`3.14` is a floating-point number, so its type is `float`.
What is the output of `gettype("PHP")`?
A
"string" B
"char" C
"text" D
"letter"
Analysis & Theory
A value like `"PHP"` is a string, so `gettype("PHP")` returns `'string'`.
Which of the following is a compound data type in PHP?
A
string B
integer C
array D
float
Analysis & Theory
`array` is a compound data type because it can hold multiple values.