Question:- What are magic constants in PHP?
Answer:- PHP magic constants are predefined constants, which change based on their use. They start with a double underscore (__) and end with a double underscore (__).
Question:- How many data types are there in PHP?
Answer:- PHP data types are used to hold different types of data or values. There are 8 primitive data types which are further categorized in 3 types: Scalar types Compound types Special types
Question:- How to do single and multi line comment in PHP?
Answer:- 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.
Question:- What are the different loops in PHP?
Answer:- For, while, do-while and for each.
Question:- What is the use of count() function in PHP?
Answer:- The PHP count() function is used to count total elements in the array, or something an object.
Question:- What is the use of header() function in PHP?
Answer:- 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 cant print any HTML element before using this function.
Question:- What does isset() function?
Answer:- The isset() function checks if the variable is defined and not null.
Question:- Explain PHP parameterized functions.
Answer:- 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.
Question:- Explain PHP variable length argument function
Answer:- 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.
Question:- Explain PHP variable length argument function.
Answer:- PHP supports variable length argument function. It means you can pass 0, 1 or n number of arguments.
Question:- What is the array in PHP?
Answer:- 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.
Question:- How many types of array are there in PHP?
Answer:- 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.
Question:- Explain some of the PHP array functions?
Answer:- There are many array functions in PHP: array(), array_change_key_case(), array_chunk(), count(), sort(), array_reverse(), array_search(), array_intersect()
Question:- What is the difference between indexed and associative array?
Answer:- The indexed array holds elements in an indexed form which is represented by number starting from 0 and incremented by 1. For example: $season=array("summer","winter","spring","autumn"); The associative array holds elements with name. For example: $salary=array("Sonoo"=>"350000","John"=>"450000","Kartik"=>"200000");
