21 Strings & Functions questions from the PHP bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.
Free to start: the 2-minute IT readiness check — six questions and a result.
A.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
B.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
C.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
D.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
Answer + AI explanation with Pro
2. Which term means: "the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output"?
Junior
A.String interpolation
B.Variadic parameter
C.Named arguments
D.Heredoc
Answer + AI explanation with Pro
3. Which statement is correct?
Junior
A.String interpolation — the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
B.String interpolation — the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
C.String interpolation — a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
D.String interpolation — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
Answer + AI explanation with Pro
4. What is Heredoc?
Junior
A.a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
B.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
C.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
D.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
Answer + AI explanation with Pro
5. Which term means: "a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string"?
Junior
A.Heredoc
B.Nowdoc
C.Named arguments
D.First-class callable syntax
Answer + AI explanation with Pro
6. Which statement is correct?
Junior
A.Heredoc — a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
B.Heredoc — the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
C.Heredoc — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
D.Heredoc — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
Answer + AI explanation with Pro
7. What is Nowdoc?
Mid
A.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
B.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
C.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
D.a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
Answer + AI explanation with Pro
8. Which term means: "a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing"?
Mid
A.First-class callable syntax
B.Variadic parameter
C.Arrow function
D.Nowdoc
Answer + AI explanation with Pro
9. Which statement is correct?
Mid
A.Nowdoc — a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
B.Nowdoc — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
C.Nowdoc — a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
D.Nowdoc — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
Answer + AI explanation with Pro
10. What is Variadic parameter?
Mid
A.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
B.a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
C.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
D.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
Answer + AI explanation with Pro
11. Which term means: "a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function"?
Mid
A.String interpolation
B.Named arguments
C.Variadic parameter
D.Arrow function
Answer + AI explanation with Pro
12. Which statement is correct?
Mid
A.Variadic parameter — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
B.Variadic parameter — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
C.Variadic parameter — a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
D.Variadic parameter — a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
Answer + AI explanation with Pro
13. What is Named arguments?
Mid
A.a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
B.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
C.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
D.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
Answer + AI explanation with Pro
14. Which term means: "passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely"?
Mid
A.Variadic parameter
B.Arrow function
C.Named arguments
D.String interpolation
Answer + AI explanation with Pro
15. Which statement is correct?
Mid
A.Named arguments — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
B.Named arguments — passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
C.Named arguments — the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
D.Named arguments — a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
Answer + AI explanation with Pro
16. What is Arrow function?
Mid
A.the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
B.a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
C.a multi-line string syntax opened with three less-than signs and a single-quoted identifier whose body is treated literally with no variable parsing
D.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
Answer + AI explanation with Pro
17. Which term means: "a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value"?
Mid
A.Arrow function
B.Named arguments
C.First-class callable syntax
D.String interpolation
Answer + AI explanation with Pro
18. Which statement is correct?
Mid
A.Arrow function — a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
B.Arrow function — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
C.Arrow function — passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
D.Arrow function — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
Answer + AI explanation with Pro
19. What is First-class callable syntax?
Senior
A.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
B.a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
C.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
D.the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
Answer + AI explanation with Pro
20. Which term means: "the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method"?
Senior
A.Named arguments
B.Heredoc
C.Nowdoc
D.First-class callable syntax
Answer + AI explanation with Pro
21. Which statement is correct?
Senior
A.First-class callable syntax — a multi-line string syntax opened with three less-than signs and an identifier whose body still parses embedded variables like a double-quoted string
B.First-class callable syntax — passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
C.First-class callable syntax — the PHP 8.1 form using three dots in parentheses, such as a method name followed by that token, which creates a Closure referencing the function or method
D.First-class callable syntax — the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
Answer + AI explanation with Pro
Free to start
Start with a free readiness check
Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every Strings & Functions question come with Pro.