1. What is PHP ?

DRex Electronics

Ans: PHP hypertext preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases.

2. What is the basic use of the PHP ?

Ans: It is basically used for developing web based software applications.

3. PHP is a server side scripting language that is embedded in ___________.


4. PHP syntax is _____

Ans: C-like

5. PHP can _____ data.

Ans: encrypt

6. What are the five basic characteristics of PHP ?


  1.  Simplicity
  2.  Efficiency
  3.  Security
  4.  Flexibility
  5.  Familiarity

7. If you want to develop php web pages then what are the three components must be installed on your system ?


  1.  Web server
  2.  Database
  3.  PHP parser

8. What is the php.ini ?

Ans: The PHP configuration file, php.ini is the final and most immediate way to affect PHP’s functionality.

9. What are the two commenting formats in PHP ?


  1.  Single-line comments
  2.  Multi-lines comments

10. PHP is a case sensitive language True or False

Ans: True

11. What is whitespace ?

Ans: Whitespace is the stuff you type that is typically invisible on the screen, including spaces, tabs  and carriage returns.

12. PHP is whitespace insensitive True or False

Ans: True

13. How to run the php script on the command prompt ?

Ans: Command: php test.php

14. All variables in PHP are denoted with a _________

Ans: $

15. PHP are perl-like True or False

Ans: True

16. What are the different data types exist in PHP ?

Ans: There are eight data types in PHP :

  1.  Integers
  2.  Doubles
  3.  Booleans
  4.  NULL
  5.  Strings
  6.  Arrays
  7.  Objects
  8.  Resources

17. What is resources ?

Ans: Resources are special variables that hold references to resources external to php. Example: database connections

18. How many scopes types exist in php ?


  1.  Local variables
  2.  Function parameters
  3.  Global variables
  4.  Static variables

19. A constant value cannot change during the execution of the script. True or False

Ans: True

20. A constant is case-senitive True or False

Ans: True

21. What are the five magic php constants ?


  1.  ____LINE___
  2.  ____FILE___
  3.  ____FUNCTION____
  4.  ____CLASS___
  5.  ____METHOD___

22. What are the five type of operators support by php ?


  1.  Arithmetic Operators
  2.  Comparison Operators
  3.  Logical (or Relational ) Operators
  4.  Assignment Operators
  5.  Conditional (or ternary ) Operators

23. What are the four loop types supports by php ?


  1.  for loop
  2.  while loop
  3.  do..while
  4.  foreach

24. What is the difference between continue statement and break statement ?

Ans: Continue : is used to halt the current iteration of a loop but it does not terminate the loop.

Break : is used to terminate the execution of a loop prematurely.

25. What are the three different kind of arrays ?


  1. Numeric array
  2. Associative array
  3. Multidimensional array

26. What is array ?

Ans: An array is a data structure that stores one or more similar type of values in a single value.

27. To concatenate two string variables together, use the _____ operator.

Ans: dot

28. The __________ function is used to find the length of a string.

Ans: strlen()

29. The __________ function is used to search for a string or character within a string.

Ans: strpos()

30. What is the name of environment variables set by php to identifies the user’s browser and operating system ?


31. The PHP  __________  is used to generate a random number.

Ans: rand() function

32. The PHP ____________ function supplies raw http headers to the browser and can be used to redirect it to another location.

Ans: header()

33. What are the two ways that browser client can send information to the web server ?


  1.  The GET method
  2.  The POST method

34. How GET method and POST method send the information ?

Ans: GET method : sends the encoded user information appended to the page request. POST method: transfers information via http headers.

35. The PHP ____________ variable can be used to get the result from data sent with both the GET andPOST methods.


36. What are the two php functions which can be used to included one PHP file into another PHP file ?

Ans: 1. The include () function 2. The require () function

37. What are the four basic steps to read a file in php ?


  1. Open a file using fopen() function
  2. Get the file length using filesize() function
  3. Read the file’s content using fread() function
  4. Close the file with fclose() function

38. A new file can be written or text can be appended  to an existing file using the PHP ________

Ans: fwrite () function

39. What is a function ?

Ans: A function is a piece of code which takes one more input in the form of parameter and does some processing and returns a value.

40. ___________ keyword is used to return a value from a function

Ans: return

41. What is cookies ?

Ans: cookies are text files stored on the client computer and they are kept of use tracking purpose.

42. PHP provided __________ function to set a cookie.

Ans: setcookie()

43. __________ variables are used to access the cookies.


44. _________ function to check if a cookie is set or not.

Ans: isset()

45. What is session ?

Ans: A session creates a file in a temporary directory on the server where registered session variables and their values are stored.

46. The location of the temporary file is determined by a  setting in the php.ini file called ___________.

Ans: session.save_path

47. A php session is easily started by making a call to the ____________ function.

Ans: session_start

48. A php session can be destroyed by _________________ function.

Ans: session_destroy

49. PHP use ______________ function to send an email.

Ans: mail()

50. What are the three mandatory arguments required to send an email ?


a. receipient’s email address
b. subject of the message
c. actual message.

51. Information in the phpinfo.php page describes the temporary directory that is used for file uploads as _______________

Ans: upload_tmp_dir

52. In phpinfo.php page describe the maximum permitted size of files that can be uploaded is stated as __________.

Ans: upload_max_filesize

53. ____________ contains a reference to every variable which is currently available within the global scope of the script.


54. _____________ is an array containing information such as headers, paths and script locations.


55. ___________ is an associative array of variables passed to the current script via the HTTP GET method.

Ans: $_GET

56. ____________ is an associative array of  variables passed to the current script via the HTTP POST method.

Ans: $_POST

57. ___________ is an associative array of items uploaded to the current script via the http POST method.

Ans: $_FILES

58. _____________  is a variable containing the text of the last error message  generated by php.

Ans: $php_errormsg

59. What are the two types of regular expression function exist in php ?


  1.  POSIX regular expression
  2.  PERL style regular expression

60. ___________ are used to find a range of characters.

Ans: Brackets ([])

61. In PHP , how many types of functions exist for searching strings using POSIX-style regular expressions.

Ans: There are seven functions exist for searching strings using POSIX-style regular expressions.

  1.  ereg()
  2.  ereg_replace()
  3.  eregi()
  4.  eregi_replace()
  5.  split()
  6.  spliti()
  7.  sql_regcase()

62. In PHP, how many types of functions exist for searching strings using perl-compatible regular expressions.

Ans: There are six functions exist for searching strings using perl-compatible regular expressions.

  1. preg_match()
  2. preg_match_all()
  3. preg_replace()
  4. preg_split()
  5. preg_grep()
  6. preg_quote()

63. ________________ is the process of catching errors raised by your program and then taking appropriate action.

Ans: Error handling

64. In PHP, how to send errors to the web server error log ?

Ans: set log_errors to On

65. What is the function name which gives you all the information that you need about the current date and time ?

Ans: time() function

66.  The __________ function returns a formatted string representing a date.

Ans: date()

67. ___________ module turns an XML document into an object that provides structured access to the xml.

Ans: simplexml

68. PHP provides a special function called _________________ to define a constructor.

Ans: __construct()

69. We can release all the resources with-in a destructor using ____________.

Ans: _destruct()

70. PHP 5 introduces the __________ keyword which prevent child classes from overriding a method by prefixing the definition with final.

Ans: final

71.What are the four things are similar between c and PHP ?


  1. Syntax
  2. Operators
  3. Control Structures
  4.  Function names

72. What are the two types of validation exist in PHP ?

Ans: 1. Client-side validation 2. Server-side validation

73. ____________ is used to provide the authentication for our web pages.

Ans: php login script

74. ___________ will erase the session data

Ans: logout.php

75. __________ is having information about php script and HTML script to do login.

Ans: login.php

76. ____________ is having information about how to logout from login session.

Ans: logout page

77. __________ will verify the session.

Ans: session.php

78. ______________ contained array of course names and it returns the value to web browser.

Ans: php_ajax.php

79. The _____________  provides the suggestions when you enter data into the field.

Ans: auto complete search box

80. _________ is used to call the data from xml file and send the result to web browsers.

Ans: livesearch.php

81. ____________ contained auto complete data and accessed by livesearch.php based on title field and url field.

Ans: autocomplete.xml

82. _____________ has contained syntax about how to get access to rss feeds and return rss feeds to web pages.

Ans: rss.php

83. A HTML Dom parser written in _____________ versions.

Ans: PHP5.X

84. What is framework ?

Ans: It is collection of software or program that trigger off easy coding and implementing the code.

85. _________ works based on model view control and having innovative plugins.

Ans: Fuel PHP

86. _____________ is a great source to build up simple and great web application in an easy way.

Ans: Cake PHP

87. ____________ is very helpful to make Restful web services and it is under MIT licence.

Ans: FlightPHP

88. ____________ is a special type that only has one value


89. ____________ containing one or more arrays and values are accessed using multiple indices.

Ans: Multidimensional arrays

90. The PHP parsing engine needs a way to differentiate PHP code from other elements in the page. This process is known as ________.

Ans: escaping to php

91. ______________  checks the DNS record of corresponding the host or ip address.

Ans: checkdnsrr function

92.  _____________ closing the connection of system logger.

Ans: closelog function

93. ____________ is used to open internet or unix domain socket connections.

Ans: fsockopen function

94. _____________  returns the error code from the last connection.

Ans: gethostbyaddr function

95. ___________ is used to get the host name

Ans: gethostname function

96. ____________ is used to get the MX records to host.

Ans: getmxrr function

97. __________ is used to get protocol number which has associated with protocol name.

Ans: getprotobyname function

98. ____________  is used to send the row of http headers.

Ans: header function

99. _________ used to convert internet package to human readable format.

Ans: inet_ntop function

100.  __________ is used to open internet or unix domain socket.

Ans: pfsockopen function