PHP Questions Home
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

PHP Interview Questions

We all know that PHP skills are in demand, and that's part of the reason why we learn and use PHP right? However, before getting that coveted job, there is the small matter of the interview to get through. Here we list some common PHP interview questions, and possible answers. If you encounter a particular question then you can contact us and we'll add it to the page.

  1. How do you access data submitted through GET or POST from a form?
  2. To access data use $_GET and $_POST respectively. For instance if a form is submitted with a field named 'email' through post, then this becomes available as $_POST[email].

    With GET, the information is posted in the URL so this is useful if you want to store or bookmark a URL that relies on parameterised data. However GET is less secure, and also has strict limits on the amount of data that can be sent.


  3. Write a simple program to get a row of information from a database?
  4. $myrow = mysql_query("SELECT name,email FROM visitors ORDER by name LIMIT 1");
    $data = mysql_fetch_row($myrow);
    $name = $data[0]; $email = $data[1];
    echo "A row from the database is name $name and email $email";


  5. What is the difference between include and require?
  6. If you require a file and it cannot be found, the script will terminate with a fatal error. If you use include then you will get an error but the script will continue to execute. Therefore when the information you wish to reference from another file is essential to the correct running of a page, use require.


  7. How do you remove the last letter from a string?
  8. There are many ways to do this. An interviewer will be looking for you to use a compact method. Here is probably the simplest method:

    $data = "One too many letterss"; $newdata = substr($data,0,-1);// now 'one too many letters'


  9. What do you need to use the image functions in PHP?
  10. You need to have access to the GD Library in order to use the image functions in PHP.




Custom Search