Strings & Functions interview questions

21 real Strings & Functions questions from the PHP bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is String interpolation?

Junior
  1. A.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  2. B.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
  3. C.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  4. D.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
Reveal the answer + AI explanation — free account

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
  1. A.String interpolation
  2. B.Variadic parameter
  3. C.Named arguments
  4. D.Heredoc
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. 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
  2. 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
  3. 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
  4. D.String interpolation — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
Reveal the answer + AI explanation — free account

4. What is Heredoc?

Junior
  1. 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
  2. B.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  3. C.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  4. D.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
Reveal the answer + AI explanation — free account

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
  1. A.Heredoc
  2. B.Nowdoc
  3. C.Named arguments
  4. D.First-class callable syntax
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. 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
  2. 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
  3. C.Heredoc — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
  4. 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
Reveal the answer + AI explanation — free account

7. What is Nowdoc?

Mid
  1. A.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
  2. B.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  3. C.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
  4. 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
Reveal the answer + AI explanation — free account

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
  1. A.First-class callable syntax
  2. B.Variadic parameter
  3. C.Arrow function
  4. D.Nowdoc
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. 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
  2. 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
  3. C.Nowdoc — a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  4. D.Nowdoc — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
Reveal the answer + AI explanation — free account

10. What is Variadic parameter?

Mid
  1. A.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  2. 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
  3. C.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  4. D.a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
Reveal the answer + AI explanation — free account

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
  1. A.String interpolation
  2. B.Named arguments
  3. C.Variadic parameter
  4. D.Arrow function
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.Variadic parameter — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
  2. 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
  3. 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
  4. D.Variadic parameter — a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
Reveal the answer + AI explanation — free account

13. What is Named arguments?

Mid
  1. 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
  2. B.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  3. C.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  4. D.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
Reveal the answer + AI explanation — free account

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
  1. A.Variadic parameter
  2. B.Arrow function
  3. C.Named arguments
  4. D.String interpolation
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Mid
  1. 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
  2. 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
  3. 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
  4. 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
Reveal the answer + AI explanation — free account

16. What is Arrow function?

Mid
  1. 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
  2. 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
  3. 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
  4. D.a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
Reveal the answer + AI explanation — free account

17. Which term means: "a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value"?

Mid
  1. A.Arrow function
  2. B.Named arguments
  3. C.First-class callable syntax
  4. D.String interpolation
Reveal the answer + AI explanation — free account

18. Which statement is correct?

Mid
  1. A.Arrow function — a single-expression closure written with the fn keyword that automatically captures variables from the enclosing scope by value
  2. B.Arrow function — a parameter prefixed with three dots that collects any number of trailing arguments into a single array inside the function
  3. 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
  4. 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
Reveal the answer + AI explanation — free account

19. What is First-class callable syntax?

Senior
  1. A.passing values to a function by the parameter's name rather than its position, letting callers skip optional defaults and reorder freely
  2. 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
  3. C.the parsing of variable references embedded directly inside a double-quoted or heredoc string so their values are substituted into the output
  4. 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
Reveal the answer + AI explanation — free account

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
  1. A.Named arguments
  2. B.Heredoc
  3. C.Nowdoc
  4. D.First-class callable syntax
Reveal the answer + AI explanation — free account

21. Which statement is correct?

Senior
  1. 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
  2. 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
  3. 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
  4. 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
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Strings & Functions free