PHP Interview Question And Answare | PHP Interview Question And Answare for Fresher | Set 03

1.What is the use of obj_start()?
 Ans: Its initializing the object buffer, so that the whole page will be first parsed (instead of parsing in parts and thrown to browser gradually) and stored in output buffer so that after complete page is executed, it is thrown to the browser once at a time.

2.Difference between mysql_connect and mysql_pconnect?
 Ans: There is a good page in the php manual on the subject, in short mysql_pconnect() makes a persistent connection to the database which means a SQL link that do not close when the execution of your script ends. mysql_connect()provides only for the databasenewconnection while using mysql_pconnect , the function would first try to find a (persistent) link that's already open with the same  host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection...
      the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use.

3.What is the difference between session_register and $_session?
 Ans: session_register() is used for register one or more global variables with the current session. While   $_SESSION[] array is used for storing one or more variables with in the current session.

4.What is the use of sprintf() function?
 Ans: The sprintf() function writes a formatted string to a variable.

         The arg1, arg2, ++ parameters will be inserted at percent (%) signs in the main string. This function works "step-by-step". At the first % sign, arg1 is inserted, at the second % sign, arg2 is inserted, etc.

5.Difference between mysql_connect and mysql_pconnect?
 Ans: mysql_connect()provides only for the databasenewconnection while using mysql_pconnect , the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection...
        the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use.

6.Explain about the $_GET variable of PHP?
 Ans: $_GET is used to collect or use values from a form with a method="GET".

         we can use it like EX : $_GET["name"]
         here, name is name/id of form element like text book for identification of them. but with the use of $_GET values can not be exceed up to 100 character.

7.How can we submit a form without a submit button?

 Ans: If you don't want to use the Submit button to submit a form, you can use normal hyper links to submit a form. But you need to use some JavaScript code in the URL of the link.

8.What is the functionality of MD5 function in PHP?

 Ans: string md5(string)
          It calculates the MD5 hash of a string. The hash is a 32-character hexadecimal number.

9.How can I load data from a text file into a table?
 Ans: The MySQL provides a LOAD DATA INFILE command. You can load data from a file. Great tool but you need to make sure that:
         a) Data must be delimited
         b) Data fields must match table columns correctly

10.Who is Known as Father of PHP?
  Ans: Rasmus Lerdorf


Previous Next


:: Click the links below for similar type Questions and answers ::

Set 01 | Set 02  | Set 03  | Set 04  | Set 05  | Set 06  | Set 07  | Set 08  | Set 09 

0 comments:

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes