Junior PHP Developer Interview Questions And Answers

Download Junior PHP Developer Interview Questions and Answers PDF

Elevate your Junior PHP Developer interview readiness with our detailed compilation of 161 questions. Each question is crafted to challenge your understanding and proficiency in Junior PHP Developer. Suitable for all skill levels, these questions are essential for effective preparation. Access the free PDF to get all 161 questions and give yourself the best chance of acing your Junior PHP Developer interview. This resource is perfect for thorough preparation and confidence building.

161 Junior PHP Developer Questions and Answers:

Junior PHP Developer Job Interview Questions Table of Contents:

Junior PHP Developer Job Interview Questions and Answers
Junior PHP Developer Job Interview Questions and Answers

1 :: Do you know what is PHP?

PHP is a server side scripting language commonly used for web applications. PHP has many frameworks and cms for creating websites. Even a non technical person can cretae sites using its CMS. WordPress, osCommerce are the famus CMS of php. It is also an object oriented programming language like java, C-sharp etc. It is very eazy for learning
Read More

2 :: Explain what is the use of "echo" in php?

It is used to print a data in the webpage, Example:
<?php echo 'Car insurance'; ?>
The following code print the text in the webpage
Read More
The main difference between sessions and cookies is that sessions are stored on the server, and cookies are stored on the user's computers in the text file format. Cookies can not hold multiple variables, But Session can hold multiple variables. We can set expiry for a cookie, The session only remains active as long as the browser is open. Users do not have access to the data you stored in Session, Since it is stored in the server.Session is mainly used for login/logout purpose while cookies using for user activity tracking
Read More

4 :: How to select a database in PHP?

mysql_select_db($db_name);
Read More

5 :: Tell me what is the use of mysql_real_escape_string() function?

It is used to escapes special characters in a string for use in an SQL statement
Read More

6 :: Do you know what is the use of rand() in php?

It is used to generate random numbers. If called without the arguments it returns a pseudo-random integer between 0 and getrandmax(). If you want a random number between 6 and 12 (inclusive), for example, use rand(6, 12). This function does not generate cryptographically safe values, and should not be used for cryptographic uses. If you want a cryptographically secure value, consider using openssl_random_pseudo_bytes() instead.
Read More

7 :: Tell us how to create an array of a group of items inside an HTML form?

We can create input fields with same name for "name" attribute with squire bracket at the end of the name of the name attribute, It passes data as an array to PHP.

☛ For instance:
<input name="MyArray[]" />
<input name="MyArray[]" />
<input name="MyArray[]" />
<input name="MyArray[]" />
Read More

8 :: Explain me what are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?

☛ Mysql_fetch_array Fetch a result row as an associative array, a numeric array, or both.
☛ mysql_fetch_object ( resource result ) Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead. Returns an object with properties that correspond to the fetched row, or FALSE if there are no more rows
☛ mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0.
Read More

9 :: Tell me what is PEAR?

PEAR is a framework and distribution system for reusable PHP components. The project seeks to provide a structured library of code, maintain a system for distributing code and for managing code packages, and promote a standard coding style. PEAR is broken into three classes: PEAR Core Components, PEAR Packages, and PECL Packages. The Core Components include the base classes of PEAR and PEAR_Error, along with database, HTTP, logging, and e-mailing functions. The PEAR Packages include functionality providing for authentication, networking, and file system features, as well as tools for working with XML and HTML templates.
Read More

10 :: Tell me what does PEAR stands for?

PEAR means “PHP Extension and Application Repository”. it extends PHP and provides a higher level of programming for web developers.
Read More

11 :: Tell me how comparison of objects is done in PHP5?

We use the operator ‘==’ to test is two object are instanced from the same class and have same attributes and equal values. We can test if two object are refering to the same instance of the same class by the use of the identity operator ‘===’.
Read More

12 :: Tell me how can we display information of a variable and readable by human with PHP?

To be able to display a human-readable result we use print_r().
Read More

13 :: Do you know what is the difference between mysql_fetch_object() and mysql_fetch_array()?

The mysql_fetch_object() function collects the first single matching record where mysql_fetch_array() collects all matching records from the table in an array.
Read More

14 :: Tell me how can we automatically escape incoming data?

We have to enable the Magic quotes entry in the configuration file of PHP.
Read More

15 :: Tell me how can you pass a variable by reference?

To be able to pass a variable by reference, we use an ampersand in front of it, as follows $var1 = &$var2
Read More

16 :: How can we access the data sent through the URL with the GET method?

In order to access the data sent via the GET method, we you use $_GET array like this:

www.globalguideline.com?var=value
$variable = $_GET[“var”]; this will now contain ‘value’
Read More

17 :: Explain how is it possible to set an infinite execution time for PHP script?

The set_time_limit(0) added at the beginning of a script sets to infinite the time of execution to not have the PHP error ‘maximum execution time exceeded’.It is also possible to specify this in the php.ini file.
Read More

18 :: Tell me what is the meaning of a final class and a final method?

‘final’ is introduced in PHP5. Final class means that this class cannot be extended and a final method cannot be overrided.
Read More

19 :: Explain what are the different errors in PHP?

In PHP, there are three types of runtime errors, they are:

☛ Warnings:
These are important errors. Example: When we try to include () file which is not available. These errors are showed to the user by default but they will not result in ending the script.

☛ Notices:
These errors are non-critical and trivial errors that come across while executing the script in PHP. Example: trying to gain access the variable which is not defined. These errors are not showed to the users by default even if the default behavior is changed.

☛ Fatal errors:
These are critical errors. Example: instantiating an object of a class which does not exist or a non-existent function is called. These errors results in termination of the script immediately and default behavior of PHP is shown to them when they take place. Twelve different error types are used to represent these variations internally.
Read More

20 :: Tell me what are the encryption techniques in PHP?

☛ MD5 PHP implements the MD5 hash algorithm using the md5 function,
eg : $encrypted_text = md5 ($msg);

☛ mcrypt_encrypt :- string mcrypt_encrypt ( string $cipher , string $key , string $data , string $mode [, string $iv ] );
Encrypts plaintext with given parameters
Read More

21 :: Tell me how to strip whitespace (or other characters) from the beginning and end of a string?

The trim() function removes whitespaces or other predefined characters from both sides of a string.
Read More

22 :: Explain me what is the use of 'print' in php?

This is not actually a real function, It is a language construct. So you can use with out parentheses with its argument list.
Example

print('PHP Interview questions');
print 'Job Interview ';
Read More

23 :: Explain me how to include a file to a php page?

We can include a file using "include() " or "require()" function with file path as its parameter.
Read More

24 :: Tell me what is the use of explode() function?

Syntax :
array explode ( string $delimiter , string $string [, int $limit ] );

This function breaks a string into an array. Each of the array elements is a substring of string formed by splitting it on boundaries formed by the string delimiter.
Read More

25 :: Explain me what is the importance of "method" attribute in a html form?

"method" attribute determines how to send the form-data into the server. There are two methods, get and post. The default method is get. This sends the form information by appending it on the URL. Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.
Read More