Freshers PHP Technical Interview Questions & Answers

Posted on 16th May 2013 12:49 PM

Advanced PHP online/classroom course, hyderabad: We Global I-Matrix Software Solutions are one of the best Web designing and development company in Hyderabad, India. If your search is for trust worthy developer then choose the best from our company. For more details Call Us 9000866292.mail us at : info@imatrixsolutions.com

PHP technical interview questions for freshers

1.Question : Who is the father of PHP and explain the changes in PHP versions?

Answer : Rasmus Lerdorf is known as the father of PHP.PHP/FI 2.0 is an early and no longer supported version of PHP. PHP 3 is the successor to PHP/FI 2.0 and is a lot nicer. PHP 4 is the current generation of PHP, which uses the Zend engine under the hood. PHP 5 uses Zend engine 2 which, among other things, offers many additional OOPs features.
2.Question : How can we submit a form without a submit button?

Answer : The main idea behind this is to use Java script submit() function in order to submit the form without explicitly clicking any submit button. You can attach the document.formname.submit() method to onclick, onchange events of different inputs and perform the form submission. you
can even built a timer function where you can automatically submit the form after xx seconds once the loading is done (can be seen in online test sites).

3.Question : In how many ways we can retrieve the data in the result set of
MySQL using PHP?

Answer : You can do it by 4 Ways

1. mysql_fetch_row.
2. mysql_fetch_array
3. mysql_fetch_object
4. mysql_fetch_assoc

4.Question : How can we extract string ‘hotmail.com ‘ from a string raghav.cool@hotmail.com using regular expression of PHP?

Answer : preg_match(”/^http://invalid.invalid/@(.+)$/”,’raghav.cool@hotmail.com’,$found);
echo $found[1];

5.Question : How can we create a database using PHP and MySQL?

Answer : We can create MySQL Database with the use of mysql_create_db(“Database Name”).

6.Question : Can we use include (”abc.PHP”) two times in a PHP page “makeit.PHP”?

Answer : Yes we can use include() more than one time in any page though it is not a very good practice.

 

7.Question : What is meant by urlencode and urldecode?

Answer : URLencode returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. It is encoded the same way that the posted data from a WWW form
is encoded, that is the same way as in application/x-www-form-urlencoded media type. urldecode decodes any %## encoding in the given string.

8.Question : What is the difference between the functions unlink and unset?

Answer : unlink() deletes the given file from the file system.
unset() makes a variable undefined.
9.Question : What is meant by urlencode and urldecode?

Answer : URLencode returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. It is encoded the same way that the posted data from a WWW form
is encoded, that is the same way as in application/x-www-form-urlencoded media type. urldecode decodes any %## encoding in the given string.

10.Question : What is the difference between the functions unlink and unset?

Answer : unlink() deletes the given file from the file system.
unset() makes a variable undefined.

11.Question : How can we register the variables into a session?

Answer : $_SESSION[’name’] = “RAGHAV”;

12.Question : How can we get the browser properties using PHP?

Answer : By using
$_SERVER[’HTTP_USER_AGENT’] variable.

Here out more php interview questions here.