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:

php Copy
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

middle

Explain the difference between exec() vs system() vs passthru() ?

middle

What is use of Null Coalesce Operator?

senior

What is the best method to merge two PHP objects?

Bình luận

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

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