PHP interview questions

Some of the Best PHP Based Interview Questions for the recent graduates to help them in their Interview in PHP

  1. What are the differences between Get and post methods in form submitting, give the case where we can use get and we can use post methods?
  2. Who is the father of PHP and explain the changes in PHP versions?
  3. How can we submit a form without a submit button?
  4. In how many ways we can retrieve the date in the result set of mysql using PHP?
  5. What is the difference between mysql_fetch_object and mysql_fetch_array?
  6. What is the difference between $message and $$message?
  7. How can we extract string ‘theWalkin.com ‘ from a string ‘http://www.TheWalkin.com’ using regular expression of PHP?
  8. How can we create a database using PHP and mysql?
  9. What are the differences between require and include, include_once?
  10. Can we use include (”TheWalkin.php”) two times in a PHP page “makeit.PHP”?
  11. What are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee(eno int(2),ename varchar(10)) ?
  12. Functions in IMAP, POP3 AND LDAP?
  13. How can I execute a PHP script using command line?
  14. Suppose your Zend engine supports the mode <? ?> Then how can u configure your PHP Zend engine to support <?PHP ?> mode ?
  15. Shopping cart online validation i.e. how can we configure Paypal, etc.?
  16. What is meant by nl2br()?
  17. Draw the architecture of Zend engine?
  18. What are the current versions of apache, PHP, and mysql?
  19. What are the reasons for selecting lamp (linux, apache, mysql, PHP) instead of combination of other software programmes, servers and operating systems?
  20. How can we encrypt and decrypt a data present in a mysql table using mysql?
  21. How can we encrypt the username and password using PHP?
  22. What are the features and advantages of object-oriented programming?
  23. What are the differences between procedure-oriented languages and object-oriented languages?
  24. What is the use of friend function?
  25. What are the differences between public, private, protected, static, transient, final and volatile?
  26. What are the different types of errors in PHP?
  27. What is the functionality of the function strstr and stristr?
  28. What are the differences between PHP 3 and PHP 4 and PHP 5?
  29. How can we convert asp pages to PHP pages?
  30. What is the functionality of the function htmlentities?
  31. How can we get second of the current time using date function?
  32. How can we convert the time zones using PHP?
  33. What is meant by urlencode and urldocode?
  34. What is the difference between the functions unlink and unset?
  35. How can we register the variables into a session?
  36. How can we get the properties (size, type, width, height) of an image using PHP image functions?
  37. How can we get the browser properties using PHP?
  38. What is the maximum size of a file that can be uploaded using PHP and how can we change this?
  39. How can we increase the execution time of a PHP script?
  40. How can we take a backup of a mysql table and how can we restore it. ?
  41. How can we optimize or increase the speed of a mysql select query?
  42. How many ways can we get the value of current session id?
  43. How can we destroy the session, how can we unset the variable of a session?
  44. How can we destroy the cookie?
  45. How many ways we can pass the variable through the navigation between the pages?
  46. What is the difference between ereg_replace() and eregi_replace()?
  47. What are the different functions in sorting an array?
  48. How can we know the count/number of elements of an array?
  49. What is the PHP predefined variable that tells the What types of images that PHP supports?
  50. How can I know that a variable is a number or not using a JavaScript?
  51. List out some tools through which we can draw E-R diagrams for mysql.
  52. How can I retrieve values from one database server and store them in other database server using PHP?
  53. List out the predefined classes in PHP?
  54. How can I make a script that can be bilanguage (supports English, German)?
  55. What are the difference between abstract class and interface?
  56. How can we send mail using JavaScript?

To Read Part – II Click Here

Share this post:

Related Posts

154 Comments

  1. amit kumar says:

    my e-mail id is below….
    amit.kumarmt,[email protected]

  2. amit kumar says:

    hello friends…

    what should i do…. which can i get a job?
    i m fresser ….
    tell me…

    your friend
    amit

  3. sharda khaan says:

    plz send me answer of these questions

  4. riyaz ahmad says:

    dear friend
    i am going interview call center plz my help send a good introduction

  5. sona says:

    plz send me answer of these questions

  6. larkin says:

    will u send me the answers of all the questions

  7. aswathy says:

    attempt is very good and hlpful,plz snd the answers also plzzzzzzzzzzzz

  8. bhavin says:

    hiiiiiii the above question are good, please send the Answers of these questions on my e-mail id
    plse…
    plse…

  9. Mayank Kumar says:

    hey plz send the answers of the above questions…it would be really helpful..thnx in advance

  10. Ashok Kumar says:

    hiiiiiii the above question are good, please send the Answers of these questions on my e-mail id

  11. Ashok Kumar says:

    hiiiiiii the above question are good, please send the Answers of these questions on my e-mail id
    plse…
    plse…

  12. Hi These are very useful for my prepration but i wanna answer for the questions…

  13. Dinesh Kumar says:

    hi the above question are good, please send the Answers of these questions on my e-mail id
    plse…
    plse

  14. hmmm says:

    helpful…

  15. sathish says:

    COULD YOU SEND ME THE ANSWERS TO THE FOLLOWING QUESTIONS 1. What are the differences between Get and post methods in form submitting, give the case where we can use get and we can use post methods?
    2. Who is the father of PHP and explain the changes in PHP versions?
    3. How can we submit a form without a submit button?
    4. In how many ways we can retrieve the date in the result set of mysql using PHP?
    5. What is the difference between mysql_fetch_object and mysql_fetch_array?
    6. What is the difference between $message and $$message?
    7. How can we extract string ‘theWalkin.com ‘ from a string ‘http://www.TheWalkin.com’ using regular expression of PHP?
    8. How can we create a database using PHP and mysql?

    9. What are the differences between require and include, include_once?
    10. Can we use include (”TheWalkin.php”) two times in a PHP page “makeit.PHP”?
    11. What are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee(eno int(2),ename varchar(10)) ?
    12. Functions in IMAP, POP3 AND LDAP?
    13. How can I execute a PHP script using command line?
    14. Suppose your Zend engine supports the mode Then how can u configure your PHP Zend engine to support mode ?
    15. Shopping cart online validation i.e. how can we configure Paypal, etc.?
    16. What is meant by nl2br()?
    17. Draw the architecture of Zend engine?
    18. What are the current versions of apache, PHP, and mysql?
    19. What are the reasons for selecting lamp (linux, apache, mysql, PHP) instead of combination of other software programmes, servers and operating systems?
    20. How can we encrypt and decrypt a data present in a mysql table using mysql?
    21. How can we encrypt the username and password using PHP?
    22. What are the features and advantages of object-oriented programming?
    23. What are the differences between procedure-oriented languages and object-oriented languages?
    24. What is the use of friend function?
    25. What are the differences between public, private, protected, static, transient, final and volatile?
    26. What are the different types of errors in PHP?
    27. What is the functionality of the function strstr and stristr?
    28. What are the differences between PHP 3 and PHP 4 and PHP 5?
    29. How can we convert asp pages to PHP pages?
    30. What is the functionality of the function htmlentities?
    31. How can we get second of the current time using date function?
    32. How can we convert the time zones using PHP?
    33. What is meant by urlencode and urldocode?
    34. What is the difference between the functions unlink and unset?
    35. How can we register the variables into a session?
    36. How can we get the properties (size, type, width, height) of an image using PHP image functions?
    37. How can we get the browser properties using PHP?
    38. What is the maximum size of a file that can be uploaded using PHP and how can we change this?
    39. How can we increase the execution time of a PHP script?
    40. How can we take a backup of a mysql table and how can we restore it. ?
    41. How can we optimize or increase the speed of a mysql select query?
    42. How many ways can we get the value of current session id?
    43. How can we destroy the session, how can we unset the variable of a session?
    44. How can we destroy the cookie?
    45. How many ways we can pass the variable through the navigation between the pages?
    46. What is the difference between ereg_replace() and eregi_replace()?
    47. What are the different functions in sorting an array?
    48. How can we know the count/number of elements of an array?
    49. What is the PHP predefined variable that tells the What types of images that PHP supports?
    50. How can I know that a variable is a number or not using a JavaScript?
    51. List out some tools through which we can draw E-R diagrams for mysql.
    52. How can I retrieve values from one database server and store them in other database server using PHP?
    53. List out the predefined classes in PHP?
    54. How can I make a script that can be bilanguage (supports English, German)?
    55. What are the difference between abstract class and interface?
    56. How can we send mail using JavaScript?

  16. prashanthi says:

    i too want answers for these questions

  17. narendra says:

    hi this is narendra kumar can any body send me answeres for my mail id please

  18. Arun says:

    hiiiiiii the above question are good………….

  19. Hi dear ,
    Actually the above questions are good.please send the answers of these questions on my email id

    Thank You
    Rangaballav swain

  20. For The Above Questions Please Send Me The Answer

  21. chandrajit says:

    plz send the answer

  22. jeeva says:

    I need answer for all question .Please send the answer on my-e-mail id

  23. Hiiiiiiiii.
    the above question are good . please send the answer of the quwestion on my e-mail id .
    please sir . i request u..

    please send the answer my email id……

  24. Please send the answers on my email- id

  25. lakshmi says:

    hi,
    the above questions are very useful to my preparation that’s why please send the answers of these questions . Those are very helpful to me. Please.

  26. Balaji.K says:

    Hi These are very useful for my prepration but i wanna answer for the questions…

  27. joe says:

    hiiiiiii the above question are good, please send the Answers of these questions on my e-mail id
    plse…
    plse…

  28. please send me this questions answers……….to my mail id

  29. deepanshu says:

    Hi,

    Please send me the answers to all these questions.

    Thanks
    Deepanshu

  30. anuj says:

    please send the answer of thease questions.

  31. please send the answers for the above questions
    kindly requested to the ATHENCIED SOFT WARE SOLUTION
    HYDERABAD, KATCHEE GUDA

  32. Sandeep says:

    How can i get u the answers of the above questions?

    If this is available in net than plz give me a link of this website..

  33. selva says:

    want to learn more about php or web development visit http://www.orxzen.com/blog/

  34. i am wants to each and every php interview question with answer so any body send me answer………….

  35. Pls send all answers from above question

  36. Plz send me Ans of the question

  37. bablu says:

    please send the Answers of these questions on my e-mail id

  38. plz send me all answers .

  39. plz send me the answers

  40. Hi!
    My name is Vikas.I Above questions are good but u have to provide answers of above question.So I request to you Please send me answers of above questions through e-mail on my id
    I am Hoping for best Reply.
    Thank You.
    VIKAS DEEP SINGH

  41. raju says:

    plz send the answer of above questions

  42. will u plz send me the answers of the above questions…

  43. sumon says:

    please send answer of all question in my email adress. thank you

  44. parul says:

    Please send all answers from above question in my mail id.

  45. Shylaja says:

    Hai,

    I know answer some of the question.Remaining one i don’t know correctly,If you send its list of answer it useful to me

    Bye
    Shylaja

  46. Please send me the answers for the above said questions please

  47. Please send me the answers to the above question part 1 and 2.

  48. ankit says:

    hi!
    the above question is very good.

    How can i get u the answers of the above questions?

    If this is available in net than plz give me a link of this website to my email id..

    thank you.

  49. hi!
    thank you for ur helful qeustions. I request to you Please send me answer list of above questions in my mail id with question.
    thank you.
    Gobind

  50. naresh says:

    Pls send all answers from above question

  51. ankit says:

    How can i get u the answers of the above questions?

    If this is available in net than plz give me a link of this website..

  52. ed says:

    Please send me the answers to the above question part 1 and 2, is it possible ? thx

  53. kushal says:

    Hi!
    My name is kushal.I know above questions are good but u have to provide answers of above question.So I request to you Please send me answer list of above questions in my mail id.
    Hoping For best Reply.
    Sorry for any mistakes.
    Thank You.
    Kushal.

  54. suman sam says:

    Hello
    i am suman thakur.Above questions definetly will help us but u have to provide answers of above question.So I request to you Please send me answer the of above questions in my mail id.
    Hoping For best Reply.
    Sorry for any mistakes.
    Thank You.
    suman

  55. vipin says:

    Difference between Https request and http

  56. manish khandelwal says:

    please send all answers from above question in my mail id.

  57. Ashutosh kumar says:

    Any one can tell me about prospect of PHP & its open sources
    which one career is better PHP or Open source?
    Every day PHP Script is going to be change a lot

  58. tinkun says:

    thanx swapna and sanjay for ur nice responce and update answers
    it helpd a lot
    though some r not correct bt still appreciate ur effort

  59. rehna says:

    please send all the answers in my email-id

  60. Govind says:

    to convert Decimal number to Binary just use “decbin()” function…

    to convert Binary number to Decimal just use “bindec()”
    function…

  61. rehna says:

    Will you please send the Qn & Answers of above Questions

  62. leo says:

    it’s nice quetions. but i need answer of these question .please send me a answer of the question

  63. akila says:

    my best wishes to you… can you send me a mail..
    ok… thank you..

  64. ashiq says:

    answers is good ,please sent me to mail

  65. Joseph Mathew says:

    Will you please send the Qn & Answers of above Questions

  66. varun says:

    can any send me the answers….

  67. Noby says:

    Pls send all answers from above question

  68. Jitesh says:

    please send answers to these questions

  69. jaydev says:

    Please give me answers in my mail Id.
    Thanks If u Send

  70. jaydev says:

    Hi!
    My name is Jaydev.I know above questions are good but u have to provide answers of above question.So I request to you Please send me answer list of above questions in my mail id.
    Hoping For best Reply.
    Sorry for any mistakes.
    Thank You.
    JayDev.

  71. abhinit raj says:

    pls send the answers of these question to my mail id

    thanks
    abhinit

  72. RIKTA says:

    Questions are very good but i want the answer immediatle.please help me.

  73. Sumch Mohammad Tarek says:

    What are the difference between abstract class and interface?

    There are some differences which of some are below..
    1.Interface can only contain abstract methods, properties but we don’t need to put abstract and public keyword. All the methods and properties defined in Interface are by default public and abstract.
    2.Abstact class is a abstract view of any realword entity and interface is more abstract one.

  74. anjana says:

    i need answers of above questions

  75. venkat says:

    plz send all answers from above questions.
    thank u
    venkat.V

  76. lakshmi says:

    plz send all answers from above questions.
    thank u

  77. sakthi says:

    i need a answer to the questions

  78. sandeep says:

    nice na!!!

  79. Rajni says:

    plz send all answers from above questions.
    thank u

  80. c says:

    openssl genrsa -des3 -out server.key 1024

  81. Smita Hatey says:

    help me out to find the ans of these quesctions. on this site there is no way fo find the ans. So plz send me the ans of all quesctions to my mail id.

  82. Rupali says:

    please help me to get the answers of the above questions.

  83. sunil says:

    Please Could you send me all answers of thats questions..

  84. admin says:

    PHP Does not support OOP Completely.

  85. Is php support oops concepts.

  86. deepthi says:

    plz send all answers from above questions.
    thank u

  87. ASHOK says:

    WHICH TYPE OF TEXT WE HAVE TO SAVE AS .HTML,.PHP . PLS EXPLAIN THE DIFFERENCE

  88. Shantha.D says:

    question are good……..but i couldn’t find answer…………….answer plz………….

  89. Shantha.D says:

    could send me answers for all tha questions mentioned above……plz

  90. Riyas says:

    please help me to get the answers of the above questions.

  91. deepthi says:

    i need the answers for these questions please send me

  92. kala says:

    i want answers for above questions……………….Plz send me……………..

  93. Gyan Chand says:

    PHP interview question

  94. test says:

    very good but no answers

  95. mamatha says:

    i saw u r questions i ts very intrestion i need answers to that questions please send me

  96. silby says:

    give tha answers of above questions

  97. i need the answers for the above questions please

  98. lucia says:

    it’s nice quetions. but i need answer of these question .please send me a answer of the question

  99. lucia says:

    i saw ur interview questions. please give answers the above questions

  100. The collection of Question is very good but answer is not available , so plz send me answer of these question.

  101. hey if u want to know all ans then look above url

  102. ayaz says:

    please i need answers of the above questions…

  103. swapna says:

    How can we optimize or increase the speed of a mysql select query?

    using LIMIT,COUNT AND CONSRAINTS LIKE
    foreignkey and primary key are used to increase the speed of a mysql select query.

  104. swapna says:

    List out the predefined classes in php?

    Directory
    stdClass
    __PHP_Incomplete_Class
    exception
    php_user_filter

  105. swapna says:

    How can we increase the execution time of a PHP script?

    set max_execution_time() in php.ini file

  106. swapna says:

    How can we register the variables into a session?

    session_register()

  107. swapna says:

    unlink delete the file from the file system
    unset make a variable undefine.

  108. swapna says:

    How can we convert the time zones using PHP?
    urlencode() returns the URL encoded version of the given string. URL coding converts special characters into % signs followed by two hex digits. For example: urlencode(“10.00%”) will return “10%2E00%25?. URL encoded strings are safe to be used as part of URLs.
    urldecode() returns the URL decoded version of the given string.

  109. swapna says:

    How can we get second of the current time using date function?
    for exm:-
    $date1=$date(‘y-m-d’);
    $date2=’2008-8-14′
    $day=(strtotime()-strtotime())/(60*60*24);

  110. swapna says:

    we encrypt and decrypt a data present in a mysql table using mysql?

    AES_ENCRYPT () and AES_DECRYPT ()

  111. swapna says:

    we encrypt the username and password using php?

    You can encrypt a password with the following Mysql>SET PASSWORD=PASSWORD(“Password”);
    We can encode data using base64_encode($string) and can decode using base64_decode($string);

  112. swapna says:

    3 types of errors in PHP?
    1)Notics
    2)Fatal
    3)warnings

  113. swapna says:

    Functions are written sequentially, so that a change in programming can affect any code that follows it.
    If a function is used multiple times in a system (i.e., a piece of code that manages the date), it is often simply cut and pasted into each program (i.e., a change log, order function, fulfillment system, etc). If a date change is needed (i.e., Y2K when the code needed to be changed to handle four numerical digits instead of two), all these pieces of code must be found, modified, and tested.
    Code (sequences of computer instructions) and data (information on which the instructions operates on) are kept separate. Multiple sets of code can access and modify one set of data. One set of code may rely on data in multiple places. Multiple sets of code and data are required to work together. Changes made to any of the code sets and data sets can cause problems through out the system.

    Object-Oriented programming takes a radically different approach:

    Code and data are merged into one indivisible item – an object (the term “component” has also been used to describe an object.) An object is an abstraction of a set of real-world things (for example, an object may be created around “date”) The object would contain all information and functionality for that thing (A date
    object it may contain labels like January, February, Tuesday, Wednesday. It may contain functionality that manages leap years, determines if it is a business day or a holiday, etc., See Fig. 1). Ideally, information about a particular thing should reside in only one place in a system. The information within an object is encapsulated (or hidden) from the rest of the system.
    A system is composed of multiple objects (i.e., date function, reports, order processing, etc., See Fig 2). When one object needs information from another object, a request is sent asking for specific information. (for example, a report object may need to know what today’s date is and will send a request to the date object) These requests are called messages and each object has an interface that manages messages.
    OO programming languages include features such as “class”, “instance”, “inheritance”, and “polymorphism” that increase the power and flexibility of an object.

  114. swapna says:

    One of the main advantages of OO programming is its ease of modification; objects can easily be modified and added to a system there by reducing maintenance costs. OO programming is also considered to be better at modeling the real world than is procedural programming. It allows for more complicated and flexible interactions. OO systems are also easier for non-technical personnel to understand and easier for them to participate in the maintenance and enhancement of a system because it appeals to natural human cognition patterns.
    For some systems, an OO approach can speed development time since many objects are standard across systems and can be reused. Components that manage dates, shipping, shopping carts, etc. can be purchased and easily modified for a specific system.

  115. swapna says:

    lamp (linux, apache, mysql, PHP).Linux operating system provide more security than windows.Apache server is more faster than other servers.php is faster than ASP and other scripting languages. all are open source softwares

  116. swapna says:

    What are the current versions of apache, PHP, and mysql?
    APACHE-2.1
    PHP 5.2.1
    MYSQL-5.1

  117. swapna says:

    nl2br() is used in HTML .nl2br function is used to print the next line .
    ex:-echo “Good morning \n Everybody”
    It prints
    Good morning
    Everybody

  118. swapna says:

    Differences between require and include, include_once?
    If the file is not included reqire shows the error and stop the execution.Include shows the warning won’t stop the exceution.
    include_once if the file is included more than once it shows the warning.

  119. swapna says:

    create Database/Scheme [IF/NOT EXISTS]
    Databasename
    [create-specification]
    [enginee=’MYISAM’];

  120. swapna says:

    $message is a variable and $$message is a reference variable.

  121. swapna says:

    Retrieve the date in the result set of mysql using PHP IN
    mysql_fetch_array()
    mysql_fetch_object()
    mysql_fetch_row()
    mysql_fetch_assoc()

  122. swapna says:

    We can submit the button without form in 3 ways.
    1)write java script function in onclick
    2)write javascript function in onload
    3)Using ajax function

  123. swapna says:

    “Rasums Lerdorf” was the father of php.He intorduced in 1994.

  124. swapna says:

    Get,Post method are used to carry data or values to another page.Get method shows tha data in adress bar this is limited data only carry.Post methos does’t shows the output dat in adress bar it has not limit specification.It provide secrecy.

  125. giriraj says:

    which function is used for read and write a file
    ans.fopen
    q2. what is the value of $$a where
    $a=5
    $b=$a
    ans. 5

  126. vivek kumar says:

    the questions are very good but i need answer of these question .please send me a answer of the question

  127. priyanka says:

    how can get the answers of the above questions??

  128. rajesh talla says:

    i need the answers for the above questions please.

  129. Always18 says:

    Q:What are the different functions in sorting an array?
    A: The functions for sorting array are following:
    1- sort($array)- is used for enumerated array(numeric array)
    sorts the array element in asending order.
    2- rsort($array)- is used for enumerated array,sorts the array element in decending order.
    3- asort($array)- is used for associative array,sorts the array value in asending order.
    4- arsort($array)- is used for associative array,sorts the array value in decending order.
    5- ksort($array)- is used for associative array,sorts the array keys in asending order.
    6- krsort($array)- is used for associative array,sorts the array keys in decending order.

  130. Always18 says:

    Q;Who was the father of PHP?
    A; “Rasmus Lerdorf” was the father of PHP. He introduced php in 1995.

  131. Always18 says:

    Q:How can we know the count/number of elements of an array?
    A:

    //returns 4
    count() function returns the no of elements of its argument.
    It returns 1 for scalar variables.

    //returns 1

  132. Always18 says:

    Q:How can we create a database using PHP and mysql?
    A:
    In the earlier versions of PHP we were using
    mysql_create_db($dbstring,$link) to create a databse,but PHP5 n latest versions of PHP do not support this function.
    Now we will have to use
    mysql_query(“create database databasename”); to create database.
    mysql_drop_db($dbname,$link) is also not supported by PHP5 n onwards versions.

  133. ajay says:

    what is a meaning of

  134. Virendra says:

    Q:-How can we know the count/number of elements of an array?
    Ans:
    count(arrayname);

  135. sanjay says:

    How can we create a database using PHP and mysql?

    We can create MySQL database with the use of mysql_create_db($databaseName) to create a database.

  136. sanjay says:

    What is the difference between $message and $$message?

    $message is simple variable
    $$message is reference variable

  137. sanjay says:

    In how many ways we can retrieve the date in the result set of mysql using PHP?

    Ans
    we can do 4 ways

    1 mysql_fetch_row
    2 mysql_fetch_array
    3 mysql_fetch_object
    4 mysql_fetch_assoc

  138. sanjay says:

    How can we submit a form without a submit button?

    Ans there is work with java script function document.formname.submit() method to on click on change event of different input and perform the form submission.

  139. sanjay says:

    Who is the father of PHP and explain the changes in PHP versions?

    Rasmus Lerdorf is known as father of php.

  140. sanjay says:

    q1 .What are the differences between Get and post methods in form submitting, give the case where we can use get and we can use post methods?

    Ans. When we submit a form, which has the GET method it displays pair of name/value used in the form at the address bar of the browser preceded by url. Post method doesn’t display these values.

  141. jaguar says:

    Good list of questions but useless without the answers

  142. subhash says:

    How can i get answers of all the questions….
    please help me to get these answers….

  143. sheeraz says:

    I need the answers of the above questions.

  144. Ankit says:

    How can i get answers of all the questions….
    please help me to get these answers….

  145. nithya says:

    How can i get u the answers of the above questions

  146. kuldip says:

    answer of above question available??????

Leave a Comment