Home / Interview / PHP :: General Questions

Interview :: PHP

21) What are the different loops in PHP?

For, while, do-while and for each.

22) What is the use of count() function in PHP?

The PHP count() function is used to count total elements in the array, or something an object.

23) What is the use of header() function in PHP?

The header() function is used to send a raw HTTP header to a client. It must be called before sending the actual output. For example, you can't print any HTML element before using this function.

24) What does isset() function?

The isset() function checks if the variable is defined and not null.

25) Explain PHP parameterized functions.

PHP parameterized functions are functions with parameters. You can pass any number of parameters inside a function. These given parameters act as variables inside your function. They are specified inside the parentheses, after the function name. Output depends upon dynamic values passed as parameters into the function.

26) Explain PHP variable length argument function

PHP supports variable length argument function. It means you can pass 0, 1 or n number of arguments in function. To do this, you need to use 3 ellipses (dots) before the argument name. The 3 dot concept is implemented for variable length argument since PHP 5.6.

27) Explain PHP variable length argument function.

PHP supports variable length argument function. It means you can pass 0, 1 or n number of arguments.

28) What is the array in PHP?

An array is used to store multiple values in a single value. In PHP, it orders maps of pairs of keys and values. It saves the collection of the data type.

29) How many types of array are there in PHP?

There are three types of array in PHP:

  1. Indexed array: an array with a numeric key.
  2. Associative array: an array where each key has its specific value.
  3. Multidimensional array: an array containing one or more arrays within itself.
30) Explain some of the PHP array functions?

There are many array functions in PHP:

  • array()
  • array_change_key_case()
  • array_chunk()
  • count()
  • sort()
  • array_reverse()
  • array_search()
  • array_intersect()