PHP5 Interview Questions & Answers

  1. Question 1. Which Will Print Out The Php Call Stack?

    Answer :

    var_dump($e->getTraceAsString());

  2. Question 2. What Enctype Is Required For File Uploads To Work?

    Answer :

    multipart/form-data


  3. PHP Interview Questions

  4. Question 3. Which Is Not A File-related Function In Php?

    Answer :

    fappend


  5. Question 4. What Would Occur If A Fatal Error Was Thrown In Your Php Program?

    Answer :

    The PHP program will stop executing at the point where the error occurred.


  6. PHP Tutorial

  7. Question 5. What Is The String Concatenation Operator In Php?

    Answer :

    ( . )


  8. MySQL Interview Questions

  9. Question 6. Which Function Can Be Used To Delete A File?

    Answer :

    unlink


  10. Question 7. What Function Should You Use To Join Array Elements With A Glue String?

    Answer :

    implode


  11. MySQL Tutorial
    PHP+MySQL Interview Questions

  12. Question 8. Which Is Useful For Method Overloading?

    Answer :

    __call,__get,__set


  13. Question 9. Which Is True About The Singleton Design Pattern?

    Answer :

    A singleton pattern means that a class can have only one instance object.


  14. Drupal Interview Questions

  15. Question 10. Which Is Incorrect With Respect To Separating Php Code And Html?

    Answer :

    As PHP is a scripting language, HTML and PHP cannot be separated.


  16. Drupal Tutorial

  17. Question 11. Which Is The Correct Way To Check If A Session Has Already Been Started ?

    Answer :

    if (session_id()) echo ‘session started’;


  18. MYSQL DBA Interview Questions

  19. Question 12. Which Cryptographic Functions In Php Returns The Longest Hash Value?

    Answer :

    sha1()



  20. PHP Interview Questions

  21. Question 13. Which Will Start A Session?

    Answer :

    session_start();


  22. WordPress Tutorial

  23. Question 14. Which Variable Declarations Within A Class Is Invalid In Php?

    Answer :

    internal $term = 3;


  24. Question 15. Does Php 5 Support Exceptions?

    Answer :

    Yes,PHP 5 supports Exceptions.


  25. WordPress Interview Questions

  26. Question 16. What Is The Best Practice For Running Mysql Queries In Php? Consider The Risk Of Sql Injection.

    Answer :

    Use PDO prepared statements and parameterized queries: for example: $input= $_POST[“user-input”] $stmt = $pdo->prepare(‘INSERT INTO table (column) VALUES (“:input”); $stmt->execute(array(‘:input’ => $input));



  27. Joomla Tutorial

  28. Question 17. What Is The Correct Line To Use Within The Php.ini File, To Specify That 128mb Would Be The Maximum Amount Of Memory That A Script May Use?

    Answer :

    memory_limit = 128M


  29. Joomla Interview Questions

  30. Question 18. Which Function Will Suitably Replace ‘x’ If The Size Of A File Needs To Be Checked? $size=x(filename);

    Answer :

    filesize



  31. MySQL Interview Questions

  32. Question 19. Which Methods Should Be Used For Sending An Email Using The Variables $to, $subject, And $body?

    Answer :

    mail($to,$subject,$body)


  33. CakePHP Tutorial

  34. Question 20. Which Is Not A Php Magic Constant?

    Answer :

    Time



  35. CakePHP Interview Questions

  36. Question 21. Which Is Used To Maintain The Value Of A Variable Over Different Pages?

    Answer :

    session_register() is used to maintain the value of a variable over different pages.

  37. Question 22. What Is The Best Way To Change The Key Without Changing The Value Of A Php Array Element?

    Answer :

    $arr[$newkey] = $arr[$oldkey]; unset($arr[$oldkey]);



  38. CodeIgniter Tutorial

  39. Question 23. Which Will Check If A Function Exists?

    Answer :

    function_exists()


  40. CodeIgniter Interview Questions

  41. Question 24. What Is The Correct Syntax Of Mail() Function In Php?

    Answer :

    mail ($to, $subject, $message,$headers)



  42. PHP+MySQL Interview Questions

  43. Question 25. Can Php Use Gettext?

    Answer :

    Yes. We can use gettext in PHP.


  44. PHP7 Tutorial

  45. Question 26. What Is The Correct Php Command To Use To Catch Any Error Messages Within The Code?

    Answer :

    set_error_handler(‘error_handler’);



  46. PHP7 Interview Questions

  47. Question 27. Which Is Correct About Mysqli And Pdo?

    Answer :

    Mysqli can only be used to access MySQL database while PDO can be used to access any DBMS.


  48. Drupal Interview Questions