Câu hỏi phỏng vấn PHP
Câu hỏi

Differentiate between parameterised and non parameterised functions

Câu trả lời

Here is the difference between parameterized and non-parameterized functions in PHP:

Parameterized Functions

  • Parameterized functions accept one or more input values called parameters or arguments.
  • Parameters are defined within the parentheses () after the function name.
  • Multiple parameters are separated by commas.
  • Parameters act as placeholders for the actual values that will be passed to the function when it is called.
  • The function can use the parameter values to perform its operations.
  • Parameterized functions provide flexibility and reusability, as they can work with different input values.

Example:

function calculateArea($length, $width) {
    $area = $length * $width;
    return $area;
}

In this example, $length and $width are parameters of the calculateArea() function.

Non-Parameterized Functions

  • N...
middle

middle

Gợi ý câu hỏi phỏng vấn

junior

Differentiate between echo and print()

entry

What does $GLOBALS mean?

middle

Maximum how many arguments are allowed in a function in PHP?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào