Saturday, December 26, 2015

Latest PHP Technical Interview Questions & Answers for Freshers



What is the latest current version of PHP?
php 5.3

What are the differences between GET and POST methods in form submitting?
On the server side, the main difference between GET and POST is where the submitted is stored. The $_GET array stores data submitted by the GET method. The $_POST array stores data submitted by the POST method.
On the browser side, the difference is that data submitted by the GET method will be displayed in the browser’s address field. Data submitted by the POST method will not be displayed anywhere on the browser.
GET method is mostly used for submitting a small amount and less sensitive data.
POST method is mostly used for submitting a large amount or sensitive data.
Explain the different types of errors in PHP.
Notices, Warnings and Fatal errors are the types of errors in PHP
Notices:
Notices represents non-critical errors, i.e. accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all but whenever required, you can change this default behavior.
Warnings: 
Warnings are more serious errors but they do not result in script termination. i.e calling include() a file which does not exist. By default, these errors are displayed to the user.
Fatal errors:
Fatal errors are critical errors i.e. calling a non-existent function or class. These errors cause the immediate termination of the script.

What are the differences between require and include?
Both include and require used to include a file but when included file not found
Include send Warning where as Require send Fatal Error .

How to find current date and time?
The date() function provides you with a means of retrieving the current date and time, applying the format integer parameters indicated in your script to the timestamp provided or the current local time if no timestamp is given. In simplified terms, passing a time parameter is optional - if you don't, the current timestamp will be used. Where as time function returns current Unix timestamp.
How can we get second of the current time using date function?
$second = date("s");
How to increase the execution time of a php script?
To Change max_execution_time variable in php.ini file .By Default time is 30 seconds.
The file path is xampp/php/php.ini if xampp software is using.
What does a special set of tags do in PHP?
In PHP special tags the use of this Tags are The output is displayed directly to the browser.
What is meant by nl2br()?
Inserts HTML line breaks (
) before all newlines in a string.
What is use of header() function in php ? What is the limitation of HEADER()?
In PHP Important to notice the Limitation of HEADER() function is that header() must be called before any actual output is send. Means must use header function before HTML or any echo statement
There are Number of Use of HEADER() function in php like below
1> The header() function use to sends a raw HTTP header to a client.
2> We can use header() function for redirection of pages.
3> Used to refresh the page on given time interval automatically.
4> To send email header content like cc, bcc , reply to etc data and lot more
How can we know the total number of elements of Array?
sizeof($array_var)
count($array_var)
If we just pass a simple var instead of a an array it will return 1.

Different Types of Tables in Mysql?
There are Five Types Tables in Mysql
1)INNODB
2)MYISAM
3)MERGE
4)HEAP
5)ISAM
What is the maximum length of a table name, a database name, or a field name in MySQL?
Database name: 64 characters
Table name: 64 characters
Column name: 64 characters
What is the difference between the functions unlink and unset?
unlink() deletes the given file from the file system.
unset() makes a variable undefined.
How can we convert asp pages to PHP pages?
There are lots of tools available for asp to PHP conversion. you can
search Google for that. the best one is available athttp://asp2php.naken.cc./
How can we set and destroy the cookie in php?
By using setcookie(name, value, expire, path, domain); function we can set the cookie in php ;
Set the cookies in past for destroy. like
setcookie("user", "sonia", time()+3600); for set the cookie
setcookie("user", "", time()-3600); for destroy or delete the cookies;

No comments:

Post a Comment