PHP Technical Interview Questions
- 1.What is the full form of phpand what is the PHP?
the full form of php is Hypertext Pre-processor.
Php is server side scripting language and Its open source and freely available. PHP easily integrated with HTML,JsvaScript and other fount End Technologies.
- 2.Why PHP called as server side scripting language?
: All PHP script are executed on server and send response back as HTMl as browser can only understand the HTML so due to all PHP code executed on server its called as server side scripted language
- 3.What is the use of var_export function in php?
: var_export() gets structured information about the given variable. It is similar to var_dump()
with one exception: the returned representation is valid PHP code with data type.
- 4.Describe the $_GET ,$_POST , $_REQUEST method in PHP ?
: in the php, you can use the $_REQUEST variable to get the data from client.we can get server response using $_GET.$_POST,$_REQUEST. When we are using “get” method from the client that time we have to use $_GET method. And when we use “post ” that time we have to use $_POST.if we are not aware about client method we can use $_REQUEST, $_REQUEST supports both $_GET and $_POST.
- 5.What is the Difference between Session and cookies in PHP ?
A cookie is a small file with the maximum size of 4KB that the web server stores on the client computer.Once a cookie has been set, all page requests that follow return the cookie name and value.
setcookie(cookie_name, cookie_value, [expiry_time], [cookie_path], [domain], [secure], [httponly]);
A session is a global variable stored on the server.
Each session is assigned a unique id which is used to retrieve stored values.
session_start(); //start the PHP_session function
$_SESSION[‘page_count’] += 1;
$_SESSION[‘page_count’] = 1;
echo ‘You are visitor number ‘ . $_SESSION[‘page_count’];
- 6.Explain the type of join in SQL?
we can use join when we want to get the data from more than one table these are the Types of join
- 7.How many types of array in PHP ?
: in PHP there are three types of Array as-
- 8.What is the associative array in PHP ?
Ans :When key are use define and alphabetic it’s called as associative array
- 9.Example of multi dimentional array in PHP ?
Ans: Array inside array is called as multi dimensional array
- 10.Difference betweenarray_combineamdarray_merge in PHP?
Ans: Array_combine is combining the array like first become is key and second become value
- Array_merge both array merge in sequential way one after another and make it as single
- 11.Difference betweenarray_merge and array_merge_recursive in PHP?
Ans: In array_merge- (if repetitive colums then replace first with second)
- In merge_recursive then if repetitive colums then make the inside array at there
- 12.What is array_chunk in PHP?
Ans: it use to devide array in multiple array.
- 13.Difference of implode and explode function in PHP?
we can convert array to string insing implode function. And we can convert string to array using explode function.
- 14.How we can use Email function in PHP ?
can use mail function using send_mail() for sending email in php.
- 15.What is the use of array_sum and array_count function in PHP?
Ans: Count – all total values in array
- Sum of all value in array
Ans: we use header function in php for –
- 16.Why we use header function in PHP?
- Used to redirect from one page to another
- File download
- Refresh the page
- 17.What is the abstract class in PHP ?
Ans: abstract class is use to define the function without body than we can implement it in child class.
- 18.Difference between abstract and interface in PHP?
Ans: interfaces need to be implement and it’s fully abstract
We can define simple function with body part in abstract class. And we can use it through inheritance.
- 19.What is the Constructor in PHP?
Ans: Constructor are like as method but it cant return the value and it will be invoked when we create the object of that class.
- 20.What is the use of static keyword in PHP?
Ans: we can access static method or data member without creating an object.
- 21.What is the use of final Class in PHP ?
Ans: final class we can’t be inherit.
- 22.What is MVC Pattern in PHP?
MVC is the application design pattern in which we can access any function of our application through the controller only.we can define database logic in model class and we can reuse it.
- 1.What is DBMS and RDBMS?
DBMS is database management system in which each table using sepratly but in RDBMS- Relational database management system in which EF.Coded has given rules that need to be follow. That called RDBMS.
- 2.What is the difference between Primarykey and foreign key in SQL?
Ans: Primary key will be usique field it’s value cant be duplate and it cant be null
Where Foreign key is just reference of Primarykey to another tablen it can be multiple in single table.
- 3.What is Trigger SQL?
Ans: it’s Special type of StoredProcedure. It’s can be invoked after or before the DML commands.
- 4.What is View in SQL?
Ans: View is use to define database structure virtually.it use to increase the process of database operations.
- 5.What is the difference between Function and StoredProcedure in SQL?
Function always return something where storedprocedure can be return every time.We can use function within procedure but can’ t procedure within function.