Home PHP Ajax Regex Interviews Contact us    

PHP


Interview Questions



.Net | PHP | Mysql | Java script

PHP interview questions
  1. What is the difference between include and require?

    If the file is not found by require(), it will cause a fatal error and halt the execution of the s cript. If the file is not found by include(), a warning will be issued, but execution will continue.

  2. What is the difference between htmlentities() and htmlspecialchars()?

    htmlspecialchars only takes care of <, >, single quote (‘), double quote (") and ampersand (&). htmlentities translates all occurrences of character sequences that have different meaning in HTML.

  3. Explain the differences of echo, print and printf

    echo() can take multiple expressions.That is we can pass multiple parameters to echo.And Echo does not return a value.

    The print method can return a true/false value.Print does not take multiple parameters.

    The printf method is used for Output a formatted string

  4. what is Output Buffering?

    Output buffering is a powerful tool in PHP which allows you to buffer a script's output. You can then edit this buffer before returning it to the client.Moreover, output buffering support allows you to write a wrapper that calls a function to compress the buffer.

  5. How do you define a constant?

    Using the function 'define()' . Eg:- define ("MAXLENGHT", 100);

  6. How can you generate a unique value in php?

    Using the function 'uniqid()'

  7. What is the use of usort() ?

    Sort an array by values using a user-defined comparison function

  8. What is the difference between mysql_fetch_array() and mysql_fetch_row() ?

    mysql_fetch_array() - Fetch a result row as an array (associative, numeric or both).It will be associative array .

    mysql_fetch_row() - Get a result row as an enumerated array.The row is returned as an array. Each result column is stored in an array offset, starting at offset 0.It will not be a associative array

  9. In one situation, we can't use GET method in a form. Which is that?

    We can not use GET mothod, if that form is used for uploading some files.POST method is must for a form, which one contain a file control.

  10. What is the difference between mysql_connect() and mysql_pconnect() ?

    mysql_connect - Opens a connection to a MySQL Server

    mysql_pconnect() - Opens a persistent connection to a MySQL Server

    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.

  11. What are the differences between Get and post methods in form submitting?

    In the get method the data made available to the action page ( where data is received ) by the URL so data can be seen in the address bar.In the post method the data will be available as data blocks and not as query string in case of get method.

  12. What is the difference between mysql_fetch_object and mysql_fetch_array?

    MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array.

  13. How can we create a database using php and mysql?

    Usingthe function mysql_create_db().

  14. What are the different types of errors in PHP?

    Fatal errors , Parse errors , Warning errors , Notice errors

  15. How can we delete a file using php?

    Using the unlink()

  16. How can we register the variables into a session?

    Using the session_register()

  17. How many ways can we get the value of current session id?

    session_id() returns the session id for the current session.

  18. How can we destroy the session, how can we unset the variable of a session?

    session_unregister -- Unregister a global variable from the current session

    session_unset -- Free all session variables

  19. How many ways we can pass the variable through the navigation between the pages?

    GET or QueryString and POST

  20. How can we destroy the cookie?

    Set the cookie expire time in setcookie()

more questions
  • What is the major difference between php4 and php5?
  • What is the difference between protect,private,public properties in a class
  • What are the features and advantages of object-oriented programming?
  • What is Inheritance?
  • What is the use of friend function?
  • How can we get the browser properties using PHP?
  • What are the main Design Patterns in PHP? (Hint-Factory Method and Abstract Factory )


Feed Back of this Topic
 
Name :
Email :
Topic :
Comments :

Ajax


Regular Expression


 
Copyright © 2007 123developers.com
Contact us | Disclaimer