PHP interview questions for php developers

Following is the list of PHP interview questions for PHP developers:

1. What is the relation between the PHP session and browser cookie?
2. Does PHP session works if the browser cookie is disabled?
3. What are the differences between PDO and MySQLi
4. How can we enable GD extension to PHP?
5. What is wrong with the following line of code?
const MY_FILEPATH = dirname(__FILE__) . '/heres-my-file.php';

6. How do we access this object?
$cars = 'tesla'; $obj = (object) $cars;

7. What is the difference between curl and file_get_contents?
8. Which method is preferred strstr or strpos for substring check?
9. What are the differences between htmlspecialchars() and htmlentities()?

10. How do we swap the first and last element of the following array without using any function?
$arr = array('BMW', 'Audi', 'Toyota');

11. $x = 3 and $y =2 How do we swap variables without using a third variable?

12. Is it possible to protect special characters in a query string?




































































































































Comments