Home Interview Questions PHP Interview Questions And Answers PDF Download 2019

PHP Interview Questions And Answers PDF Download 2019

391
0
PHP Interview Questions And Answers PDF Download

PHP Interview Questions And Answers PDF Download :Here are the top interview questions of php. Be prepared for the interview. You can download the entire questions in a pdf format. so guys All the best for your interview.

1) What is PHP?

PHP stands for Hypertext Preprocessor. It is an open source server-side scripting language which is widely used for web development. It supports many databases like MySQL, Oracle, Sybase, Solid, PostgreSQL, generic ODBC etc.


2) What is PEAR in PHP?

PEAR is a framework and repository for reusable PHP components. PEAR stands for PHP Extension and Application Repository. It contains all types of PHP code snippets and libraries.

It also provides a command line interface to install “packages” automatically.


You might also like: Top 50 Java Interview Question and Answers pdf Download


3) Who is known as the father of PHP?

Rasmus Lerdorf


4) What was the old name of PHP?

Personal Home Page.


5) Explain the difference b/w static and dynamic websites?

PHP Interview Questions And Answers PDF Download : In static websitescontent can’t be changed after running the script. You can’t change anything in the site. It is predefined.

PHP Interview Questions And Answers PDF Download : In dynamic websitescontent of script can be changed at the run time. Its content is regenerated every time a user visit or reload. Google, yahoo and every search engine is the example of dynamic website.

6) How can we register the variables into a session?

<?php
session_register($ur_session_var);
?>

7) How many ways we can pass the variable through the navigation between the pages?

Register the variable into the session
Pass the variable as a cookie
Pass the variable as part of the URL

8) How can we know the total number of elements of Array?

sizeof($array_var)
count($array_var)

9) How can we create a database using php?

mysql_create_db();

10) What is the functionality of the function strstr and stristr?

strstr() returns part of a given string from the first occurrence of a given substring to the end of the string.
For example:strstr(“[email protected]”,”@”) will return “@example.com”.
stristr() is idential to strstr() except that it is case insensitive.

11) What are encryption functions in PHP?

CRYPT(), MD5()

12) How to store the uploaded file to the final location?

move_uploaded_file( string filename, string destination)

13) Explain mysql_error().

The mysql_error() message will tell us what was wrong with our query, similar to the message we would receive at the MySQL console.

14) What is Constructors and Destructors?

PHP Interview Questions And Answers PDF Download : CONSTRUCTOR : PHP allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used.
DESTRUCTORS : PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++. The destructor method will be called as soon as all references to a particular object are removed or when the object is explicitly destroyed or in any order in shutdown sequence.
 

15) Explain the visibility of the property or method.

The visibility of a property or method must be defined by prefixing the declaration with the keywords public, protected or private.
Class members declared public can be accessed everywhere.
Members declared protected can be accessed only within the class itself and by inherited and parent classes.
Members declared as private may only be accessed by the class that defines the member.

16) What is the difference between $message and $$message?

$message stores variable data while $$message is used to store variable of variables.

$message stores fixed data whereas the data stored in $$message may be changed dynamically.More Details…


17) What are the ways to define a constant in PHP?

PHP constants are name or identifier that can’t be changed during execution of the script. PHP constants are defined in two ways:

  • Using define() function
  • Using const() function

18) What are magic constants in PHP?

PHP magic constants are predefined constants which changes on the basis of their use. They start with a double underscore (__) and end with a double underscore (__).More Details…


19) How many data types are there in PHP?

PHP data types are used to hold different types of data or values. There are 8 primitive data types which are further categorized in 3 types:

  • Scalar types
  • Compound types
  • Special types

20) How to do single and multi line comment in PHP?

PHP single line comment is done in two ways:

  • Using // (C++ style single line comment)
  • Using # (Unix Shell style single line comment)

PHP multi line comment is done by enclosing all lines within /* */.More details…


21) What are the different loops in PHP?

For, while, do-while and for each.


22) What is the use of count() function in PHP?

The PHP count() function is used to count total elements in the array, or something an object.


23) What is the use of header() function in PHP?

The header() function is used to send a raw HTTP header to a client. It must be called before sending the actual output. For example, you can’t print any HTML element before using this function.


24) What does isset() function?

The isset() function checks if the variable is defined and not null.


25) Explain PHP parameterized functions.

PHP parameterized functions are functions with parameters. You can pass any number of parameters inside a function. These passed parameters act as variables inside your function. They are specified inside the parentheses, after function name. Output depends upon dynamic values passed as parameters into function.


26) Explain PHP variable length argument function

PHP supports variable length argument function. It means you can pass 0, 1 or n number of arguments in function. To do this, you need to use 3 ellipses (dots) before the argument name. The 3 dot concept is implemented for variable length argument since PHP 5.6.


27) Explain PHP variable length argument function.

PHP supports variable length argument function. It means you can pass 0, 1 or n number of arguments.


28) What is the array in PHP?

Array is used to store multiple values in single value. In PHP, it orders maps of pairs of keys and values. It stores the collection of data type.


29) How many types of array are there in PHP?

There are three types of array in PHP:

  • Indexed array
  • Associative array
  • Multidimensional array

You might also like: Top 20 MongoDB Interview Questions and Answers


30) Explain some of the PHP array functions?

There are many array functions in PHP:

  • array()
  • array_change_key_case()
  • array_chunk()
  • count()
  • sort()
  • array_reverse()
  • array_search()
  • array_intersect()

PHP Interview Questions And Answers PDF Download

You might like our Latest posts :