PHP Interview Question Set 4
Categories: PHP
How to do single and multi line comment in PHP?
PHP single line comment is made in two ways:
Using // (C++ style single line comment)
Using # (Unix Shell style single line comment)
PHP multi-line comment is made by enclosing all lines within.
What are the different loops in PHP?
For, while, do-while and for each.
What are the different loops in PHP?
For, while, do-while and for each.
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.
What does isset() function?
The isset() function checks if the variable is defined and not null.
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.
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.
Explain PHP variable length argument function.
PHP supports variable length argument function. It means you can pass 0, 1 or n number of arguments.
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.
How many types of array are there in PHP?
There are three types of array in PHP:
- Indexed array: an array with a numeric key.
- Associative array: an array where each key has its specific value.
- Multidimensional array: an array containing one or more arrays within itself.