Podcast
Questions and Answers
What is the syntax for declaring a user-defined function in PHP?
What is the syntax for declaring a user-defined function in PHP?
- function name(param) //code to be executed by the function
- function name(param) { //code to be executed by the function } (correct)
- function name = (param) { //code to be executed by the function }
- function name = (param) //code to be executed by the function
Which statement best describes a user-defined function in PHP?
Which statement best describes a user-defined function in PHP?
- A group of PHP statements that performs a specific task
- A function that is built-in into PHP to perform some standard operations
- A function that allows you to reuse the same code in different locations (correct)
- A function that returns a value
Which of the following is an example of a function with no parameters?
Which of the following is an example of a function with no parameters?
- function multiply(a, b) { return a * b; }
- function square(x) { return x * x; }
- function sum(a, b) { return a + b; }
- function greet() { echo 'Hello!'; } (correct)
What does a function that returns a value do?
What does a function that returns a value do?
What is a nested function in PHP?
What is a nested function in PHP?