YouTube Icon

Interview Questions.

Top 27 Php5 Interview Questions - Jul 27, 2022

fluid

Top 27 Php5 Interview Questions

Q1. What Function Should You Use To Join Array Elements With A Glue String?

Implode

Q2. Which Is True About The Singleton Design Pattern?

A singleton sample me that a class could have simplest one instance item.

Q3. Which Will Check If A Function Exists?

Function_exists()

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

Use PDO organized statements and parameterized queries: as an instance: $input= $_POST["user-input"] $stmt = $pdo->put together('INSERT INTO desk (column) VALUES (":enter"); $stmt->execute(array(':enter' => $enter));

Q5. Which Is Incorrect With Respect To Separating Php Code And Html?

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

Q6. Which Is Used To Maintain The Value Of A Variable Over Different Pages?

Session_register() is used to keep the price of a variable over one-of-a-kind pages.

Q7. Does Php five Support Exceptions?

Yes,PHP five helps Exceptions.

Q8. Which Is Not A File-related Function In Php?

Fappend

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

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

Q10. Which Will Start A Session?

Session_start();

Q11. Which Is Useful For Method Overloading?

__call,__get,__set

Q12. Which Cryptographic Functions In Php Returns The Longest Hash Value?

Sha1()

Q13. What Enctype Is Required For File Uploads To Work?

Multipart/shape-records

Q14. Which Function Can Be Used To Delete A File?

Unlink

Q15. 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?

Memory_limit = 128M

Q16. What Is The Correct Syntax Of Mail() Function In Php?

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

Q17. Which Is Not A Php Magic Constant?

Time

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

Set_error_handler('error_handler');

Q19. Which Methods Should Be Used For Sending An Email Using The Variables $to, $situation, And $frame?

Mail($to,$issue,$frame)

Q20. What Would Occur If A Fatal Error Was Thrown In Your Php Program?

The PHP program will forestall executing on the factor wherein the mistake happened.

Q21. Which Variable Declarations Within A Class Is Invalid In Php?

Internal $term = 3;

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

If (session_id()) echo 'session began';

Q23. Which Is Correct About Mysqli And Pdo?

Mysqli can most effective be used to get right of entry to MySQL database even as PDO can be used to access any DBMS.

Q24. What Is The String Concatenation Operator In Php?

( . )

Q25. Which Function Will Suitably Replace 'x' If The Size Of A File Needs To Be Checked? $length=x(filename);

filesize

Q26. Which Will Print Out The Php Call Stack?

Var_dump($e->getTraceAsString());

Q27. Can Php Use Gettext?

Yes. We can use gettext in PHP.




CFG