Junior PHP Developer Interview Questions & Answers
Download 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 :: Please explain is it possible to use COM component in PHP?

Yes, it’s possible to integrate (Distributed) Component Object Model components ((D)COM) in PHP scripts which is provided as a framework.

2 :: Tell me whether it is possible to share a single instance of a Memcache between multiple PHP projects?

Yes, it is possible to share a single instance of Memcache between multiple projects. Memcache is a memory store space, and you can run memcache on one or more servers. You can also configure your client to speak to a particular set of instances. So, you can run two different Memcache processes on the same host and yet they are completely independent. Unless, if you have partitioned your data, then it becomes necessary to know from which instance to get the data from or to put into.

3 :: Explain what does the unset() function means?

The unset() function is dedicated for variable management. It will make a variable undefined.

4 :: How to update Memcached when you make changes to PHP?

When PHP changes you can update Memcached by

• Clearing the Cache proactively: Clearing the cache when an insert or update is made
• Resetting the Cache: It is similar to the first method but rather than just deleting the keys and waiting for the next request for the data to refresh the cache, reset the values after the insert or update.

5 :: Do you know what does $GLOBALS means?

$GLOBALS is associative array including references to all variables which are currently defined in the global scope of the script.

6 :: Do you know what is the function mysql_pconnect() usefull for?

mysql_pconnect() ensure a persistent connection to the database, it means that the connection do not close when the the PHP script ends.
A persistent cookie is permanently stored in a cookie file on the browser’s computer. By default, cookies are temporary and are erased if we close the browser.

8 :: Explain how can PHP and Javascript interact?

PHP and Javascript cannot directly interacts since PHP is a server side language and Javascript is a client side language. However we can exchange variables since PHP is able to generate Javascript code to be executed by the browser and it is possible to pass specific variables back to PHP via the URL.

9 :: Tell me how to find current date and time?

The date() function provides you with a means of retrieving the current date and time, applying the format integer parameters indicated in your script to the timestamp provided or the current local time if no timestamp is given. In simplified terms, passing a time parameter is optional - if you don't, the current timestamp will be used.

10 :: Explain what are the two main string operators?

The first is the concatenation operator (‘.’), which returns the concatenation of its right and left arguments. The second is (‘.=’), which appends the argument on the right to the argument on the left.

11 :: Tell me what is the use of "enctype" attribute in a html form?

The enctype attribute determines how the form-data should be encoded when submitting it to the server. We need to set enctype as "multipart/form-data" when we are using a form for uploading files

12 :: Explain what is the difference between $var and $$var?

They are both variables. But $var is a variable with a fixed name. $$var is a variable who's name is stored in $var. For example, if $var contains "message", $$var is the same as $message.

13 :: Tell me what is the difference between ereg_replace() and eregi_replace()?

The function eregi_replace() is identical to the function ereg_replace() except that it ignores case distinction when matching alphabetic characters.

14 :: Explain me what is the use of header() function in php?

The header() function sends a raw HTTP header to a client browser. Remember that this function must be called before sending the actual out put. For example, You do not print any HTML element before using this function.

15 :: Tell me what is the use of the function htmlentities?

htmlentities Convert all applicable characters to HTML entities This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.

16 :: Explain what does $_SERVER means?

$_SERVER is an array including information created by the web server such as paths, headers, and script locations.

17 :: Tell me how is the ternary conditional operator used in PHP?

It is composed of three expressions: a condition, and two operands describing what instruction should be performed when the specified condition is true or false as follows:

Expression_1 ? Expression_2 : Expression_3;

18 :: Tell me is it possible to submit a form with a dedicated button?

It is possible to use the document.form.submit() function to submit the form. For example: <input type=button value=”SUBMIT” onClick=”document.form.submit()”>

19 :: Tell me how to execute an sql query? How to fetch its result?

$my_qry = mysql_query("SELECT * FROM `users` WHERE `u_id`='1'; ");
$result = mysql_fetch_array($my_qry) or die ('Error: Unable to get data.');
echo $result['First_name'];

20 :: Tell me what does the scope of variables means?

The scope of a variable is the context within which it is defined. For the most part all PHP variables only have a single scope. This single scope spans included and required files as well.

21 :: Tell me how can we connect to a MySQL database from a PHP script?

To be able to connect to a MySQL database, we must use mysql_connect() function as follows:

<!--?php $database = mysql_connect("HOST", "USER_NAME", "PASSWORD"); mysql_select_db("DATABASE_NAME",$database); ?-->

22 :: Explain me is multiple inheritance supported in PHP?

PHP includes only single inheritance, it means that a class can be extended from only one single class using the keyword ‘extended’.

23 :: Tell us how to redirect a page in php?

The following code can be used for it,
header("Location: http://www.globalguideline.com/");

24 :: Tell me will a comparison of an integer 12 and a string “13” work in PHP?

“13” and 12 can be compared in PHP since it casts everything to the integer type.

25 :: Tell me what should we do to be able to export data into an Excel file?

The most common and used way is to get data into a format supported by Excel. For example, it is possible to write a .csv file, to choose for example comma as separator between fields and then to open the file with Excel.
Junior PHP Developer Interview Questions and Answers
161 Junior PHP Developer Interview Questions and Answers