MockQuestions

PHP Basic Concepts Mock Interview

To help you prepare for your PHP Basic Concepts interview, here are 21 interview questions and answer examples.

Get More Information About Our PHP Basic Concepts Interview Questions

Question 1 of 21

What is the default maximum PHP script execution time? and how can you increase it?

The max. script execution time for PHP is 30 seconds (by default).
If a script takes longer than 30 seconds, then we get a fatal error, and the script is stopped.

The error looks like this:

Fatal error: Maximum execution time of 30 seconds exceeded in sample_script.php

We can increase the script execution time by going to the php.ini file. There are two relatively simple ways of increasing execution time.

1. Modify the max_execution_time value in the php.ini file and set acc. to our requirements.

2. Change the max_execution_time value by using ini_set() function as :

ini_set('max_execution_time', 300);

In this case, 300 represents seconds so this translates into 5 minutes, so the script max. execution time is set to 5 minutes.

We can follow any one of the methods above to change the PHP max. execution time.

Written by on May 4th, 2021

Next Question

21 PHP Basic Concepts Interview Questions & Answers

Below is a list of our PHP Basic Concepts interview questions. Click on any interview question to view our answer advice and answer examples. You may view six answer examples before our paywall loads. Afterwards, you'll be asked to upgrade to view the rest of our answers.

  • 1. What is the default maximum PHP script execution time? and how can you increase it?

  • 2. What is the difference between echo and print in php?

  • 3. What is the difference between explode() and preg_split() in PHP?

  • 4. Can we access a variable defined outside of a function ( in global scope ) inside the function directly?

  • 5. Is it possible to submit a form without a submit button in PHP, if so how?

  • 6. What are some of the different ways of defining constants in PHP?

  • 7. State the four different types of errors in PHP.

  • 8. What is the difference between single quoted string and double quoted string in PHP?

  • 9. What is post and pre-increment in PHP ( or what's the difference between ++$i and $i++ )?

  • 10. What is the difference between $ and $$ in PHP?

  • 11. What is output buffering in PHP? What are some of the benefits of output buffering?

  • 12. How can you display output directly into the browser using PHP (without echo or print or any other pre-defined functions)?

  • 13. Write the output of the given program: $clothes= ["Gloves", "T-shirt", "Jacket", "Shoes", "Shocks"]; $clothes= array_flip($clothes); echo $clothes['T-shirt'];

  • 14. Create an array and check if a value (dummy value) is inside that array. If it is there, then join the array values with a comma and a space.

  • 15. Write a PHP script that tests and matches the string: 123-456-7890 and prints a message if there is a successful match.

  • 16. Write down the regular expression that matches someuser@gmail.com.

  • 17. Mention the difference between require() and require_once() .

  • 18. What is the difference between a for and a foreach loop in PHP?

  • 19. Show/State the two most common string operators being used practically in PHP.

  • 20. How can you determine the number of rows affected by a query executed using php?

  • 21. Can PHP and Javascript communicate or interact directly?