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

What is use of Null Coalesce Operator?

middle

Is there any reason to use strcmp() for strings comparison?

middle

Differentiate between exception and error

Bình luận

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

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