All PHP Interview Questions & Answers

All PHP Interview Questions & Answers list

Here, you can find PHP Interview Questions & Answers related to Arrays, Operators, Loops, Variables, Conditional Statements, Strings, Form, MySQL, Cookies, and Sessions. These popular & frequently asked interview questions are listed under different categories.

Tutorials Class covers Interview Questions for Freshers as well as Experienced professionals. We not only list core PHP but also provide Advanced PHP interview questions for students.

How many types of arrays are available in PHP?

There are three types of array available in PHP.

  1. Numeric (Indexed) array
  2. Associative array
  3. Multidimensional array

Learn more about array with examples in PHP Array Tutorial


What is the use of ucwords() PHP String function?

PHP ucwords() function is used to capitalized the first letter of each word in String.

Run : http://ideone.com/83vvyF


What is the use of array_chunk() function in PHP?

The array_chunk() function is used to split an array into parts or chunks of new arrays. Example: array_chunk(array,size);

The first parameter specifies an array and the second parameter defines the size of each chunk.


What is the use of str_replace() PHP String function?

The PHP str_replace() function is used to search & replace some words in a strings.

In this example, “Hello” word will be replaced by “Hi” in the given string.

Run : http://ideone.com/AFs0DW


What is the use of in_array() function in PHP?

The in_array() function is used to search for the given string in an array. It returns TRUE if the given string is found in the array, and FALSE otherwise.


Which PHP function counts all the values of an array?

array_count_values() function is used to count all the values of an array. PHP array_count_values() returns an array that has the values of given array as keys and their frequency in the array as values.


What is the latest version of PHP?

The latest stable version of PHP is 7.3. As per the latest update, PHP 7.3.4 released at April 4, 2019.

For more detail about PHP version, visit official PHP website: php.net


How can we submit a form without a submit button?

Java script submit() function is used for submit form without submit button. For example: document.formname.submit()


Can we include a file two times in any PHP page?

Yes, we can use include("sample.php") function more than once in any PHP page. It will include code from ‘sample.php’ file multiple times.

Note: If ‘sample.php’ file contains some functions declaration, there will be an error. Why? Because it will try to separate function with the same name again and it will throw an error.


What is the full form of PHP?

PHP originally stood for Personal Home Page, but it now stands for the recursive backronym PHP: Hypertext Preprocessor.