0% found this document useful (0 votes)
52 views14 pages

PHP Interviewquestions PDF: Umar Farooque Khan

Uploaded by

Redouan AFLISS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views14 pages

PHP Interviewquestions PDF: Umar Farooque Khan

Uploaded by

Redouan AFLISS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

PHP INTERVIEWQUESTIONS

PDF

Created By:
Umar Farooque Khan

1
Copyright © pTutorial · All Rights Reserved
PHP Interview Questions For Fresher

Q:-01. Full name of PHP?

The full name of PHP is or PHP stand for "Hypertext Pre-processor".

Q:-02. Who is the inventor of PHP?

Rasmus Lerdorf (Born 22 November 1968) is a Greenlandic programmer with


Canadian citizenship.

Q:-03 . Is PHP embed in HTML?

Yes we can embed PHP in HTML.

Q:-04 . Current Version of PHP?

Current version compatible with PHP 5.6.1.

Q:-05. What Is PHP?

PHP is a Hypertext Pre-processor, Which is widely used Open Source general-


purpose scripting language that is suited for Web development and can be
embedded into HTML. Most of PHP syntax is based on C. They should make
2
Copyright © pTutorial · All Rights Reserved
PHP easy to pick up for Programmers. Generally PHP is used for Dynamic web
application.

Q:-06. What are the differences between GET and POST

There are some difference between GET and POST method 1. When we use
GET method requested data show in URL while when we use post method
request data does not show in the URL. 2. Post method is more secure than get
method.

Q:-07. PHP is Compiler or Interpreter?

PHP is an interpreted language

Q:-08. What is full name of WAMP?

WAMP: Windows Apache MySQL PHP.

Q:-09. What is server?

Server is the device (computers) which connects multiple devices or clients, it


receives the client requests and gives response to them.

Q:-10. What is the Difference between echo () and print ().

Echo () and print () are not functions but language constructs in PHP. They are
both used to deliver strings as output. The main difference is print deliver only
one string as output while echo statement deliver one or more string as output.
One difference is echo is faster than print.
3
Copyright © pTutorial · All Rights Reserved
Q:-11. What are the differences between require and include function?

Both include and require function are used for including file into a current script.

The main difference is, require function will produce fatal error and stop execution
of script, as the name suggests this file is required for execution of this script.
While include function will only produce Warning and continue the script.

Q:-12. What are the differences between include and include_once?

The include function is used in PHP when you want to include a file within the
current script. It takes only one argument.

Include_once function is same as include function except it will execute or


include that file once. You can include same file many times in case of include
while in case of include_once you can only once.

Example
You can put your include function within the loop but in case of include_once it
will display only once.

Q:-13.How we get IP address of client, previous reference page etc.

By using $_SERVER['REMOTE_ADDR'],$_SERVER['HTTP_REFERER'] etc.

4
Copyright © pTutorial · All Rights Reserved
Q:-14. How many ways can we get the value of current session id?

There are only one way to get value of current session id that is, session_id()
function returns the current session id.

Q:-15. How can we set and destroy the cookie in PHP?

We use setcookies() function to set and destroy the cookies by using this function
we can set and destroy the PHP cookies.
For set cookies setcookie("user", "", time()+300);
For destroy cookies setcookie("user", "", time()-300);

Q:-16. What are the different functions in sorting an array?

There are lot of function available for sorting an array like Sort(), arsort(), asort(),
ksort(), natsort(), natcasesort(), rsort(), usort(), array_multisort().

Q:-17.What is the difference between $i-- and --$i?

The $i-- is post decrement but --$i is pre decrement.

Q:-18.How many types of arrays in PHP?

There are three types of array in PHP

Numeric Array

5
Copyright © pTutorial · All Rights Reserved
Associative Array

Multidimensional array

Q:-19. What is the use of header function in PHP?

Header function allows sending a raw HTTP header to the client browser. The
most common usages is simply redirecting a user to elsewhere i.e. to another
URL.

Example
<?php
echo"umar";
header("Location:http://www.ptutorial.com/");
?>

Q:-20.What is the use of isset function?

Isset() function determine whether a variable has been declared and loaded with
a value by programmer. Return true if such a variable is passed to it. If not it
return false.

Q:-21. How can we register the variables into a session?

We can register a simple variable into a session variable by using super global
array $_session.
$_SESSION['name'] = "user";

6
Copyright © pTutorial · All Rights Reserved
Q:-22. What is the difference between --$variable and $variable--?

--$variable is pre decrement and $variable – post decrement.

Q:-23 .How much data we can upload into the database (By default)?

By Default its size:- 2MB

Q:-24 .Who is the more secure method GET or POST?

Post method is the secure method than GET.

Q:-25.How can we get the browser properties using PHP?

We can get the server properties by using $_SERVER super global array.
$_SERVER['HTTP_USER_AGENT']

Q:-26. What is full name of WAMP, XAMP, and LAMP?

WAMP: Windows Apache MySQL PHP


XAMP: Extensible Apache MySQL PHP
LAMP: Linux Apache MySQL PHP

7
Copyright © pTutorial · All Rights Reserved
Q:-27.What is difference between mysql_fetch_array() and mysql_fetch_row()?

mysql_fetch_array() return entire row of mysql database into an indexed array.

mysql_fetch_row() return entire row of mysql database into an associative


arrary by default,you can specify the type of array mapping

Q:-28. What is the use of @ symbol in front of mysql_connect()?

The @ symbol inform mysql_connect() that if the database connection failed do


nothing. Hence no system error displayed if the connection fails.

Q:-29. Which function is used to connect the mysql database engine?

Mysql_connect() is used to connect the database engine.

Q:-30. Why use mysql_query() in php mysql?

mysql_query is used to execute the mysql query. It accept a variable which was
the previously loaded with the query string.

Q:-31. What is the use of Perl in PHP?

Perl is known as PHP extension and application repository. It provides the


structured library to the PHP users also gives provision for package maintenance.

8
Copyright © pTutorial · All Rights Reserved
Q:-32. What are the different function in sorting an array?

sort, arsort, asork, ksort, rsort, natsort, uksort, Array_multisort Etc.

Q:-33. What is the use of in_array() function in PHP?

In PHP in_array function is used to check whether given value exist in an array
or not.

Q:-34. How to set cookies in PHP?

Setcookies ("name","php",time()+3600);

Q:-35. What is the difference between PHP and java Script?

The difference lies with the execution of the languages. PHP is a server side
scripting language, that means PHP can’t interact directly with the user. Whereas,
Java Script is a client side scripting language, that is used to interact directly with
the user.

Q:-36. What is the use of "ksort " in PHP?

ksort() function sort is used to sort an arrays key in reverse order.

Q:-37. What is the use of mysql_real_escap_string()?

It is used to escape special character in a string for use in an SQL statement.

9
Copyright © pTutorial · All Rights Reserved
Q:-38. What is the difference bitweeb mysql_fetch_array() and mysql_fetch_asoc()?

mysql_fetch_array() function fetch a result row as an associative array while


mysql_fetch_asoc() fetches an associative array, a numeric array, or both.

Q:-39. How to redirect a web page in PHP?

Header function is used to redirect from one webpage to another webpage Eg:
header("Location:uk.html");

Q:-40. How to redirect a web page after fixed time interval?

Header function is used to redirect from one webpage to another webpage.


Example: header( "refresh:7; url=uk.php" );

Q:-41. In PHP 5 class, what are the three different visibility keywords of a property of
the method?

Private - only the class itself may call a method or property


Public – any class may instantiate the class called the member and member
function
Protected - Only the class itself or inherited classes may call a method or
property.

Q:-42. What is the use of isset() function in PHP?

It is used to determine whether a given variable is set or not. That means giving
variable have a value or not.

10
Copyright © pTutorial · All Rights Reserved
Q:-43. In how many ways we can retrieve the data from MySql database using PHP?

There are four ways to retrieve the data from database


1. Mysql_fetch_row() functiom
2. Mysql_fetch_array() functiom
3. Mysql_fetch_object() functiom
4. Mysql_fetch_assoc() functiom

Q:-44. How can we get the second of the current time using date function?

Date(‘s’);

Q:-45. What is the difference between function unlink and unset?

Unlink deletes the given file from the file system while unset makes a variable
undefined means delete the variable value.

Q:-46. How can we register the variable into the session?

$_SESSION[‘name’]="Umar";

Q:-47. How to set a page as a home in PHP based site?

Index.php is the default name of the home page in a PHP based website.

11
Copyright © pTutorial · All Rights Reserved
Q:-48. What is use of count() function in PHP?

Count function is used to count all the elements of an array.

Q:-49. How do you define a constant in PHP?

define("PI", "3.141592");

Q:-50. How to get the current session ID?

Session_id() returns the session id for the current session.

Q:-51. What is the value of $a in the following program?

$x ="5 Coin"
$a=$a+20;
Echo $a;
Output : 15

Q:-52. How to delete a file from file system using PHP?

Unlink() function deletes the given file from file system.

Q:-53. What is mean by an associative array in PHP?

Associative arrays are also an array with string keys.

12
Copyright © pTutorial · All Rights Reserved
Q:-54. What is the use of rand() function in PHP?

rand () function is basically used to generate random number in PHP.

Q:-55. How to find the length of the string in PHP?

Strlen() function is used to count the length of the string.

Q:-56. Why we use $_REQUEST super global array in PHP?

We use $_REQUEST super global array in PHP to collect the data value from
$_GET, $_POST and $_COOKIES variable.

Q:-57. What is the output of the following program?

Echo1<2;
Output: 1

Q:-58. What is Apache Configuration file typically called?

The name of the Apache Configuration file named is Httpd.conf

Q:-59. Give the some example of the super global array in PHP?

$_GET, $_POST, $_SESSION, $_COOKIES, $_SERVER, $_REQUEST

13
Copyright © pTutorial · All Rights Reserved
Q:-60. How would you determine the size of a file in PHP?

The filesize() function return a file size in bytes

Q:-61. What are the encryption functions in PHP?

crypt() function and md5()function.

14
Copyright © pTutorial · All Rights Reserved

You might also like