Junior PHP Developer Interview Preparation Guide
Download PDF

Junior PHP Developer related Frequently Asked Questions in various Junior PHP Developer job interviews by interviewer. The set of questions here ensures that you offer a perfect answer posed to you. So get preparation for your new job hunting

161 Junior PHP Developer 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

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

3 :: Explain what is the difference between Session and Cookie?

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

4 :: How to select a database in PHP?

mysql_select_db($db_name);

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

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.

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[]" />

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.

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.

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.