Wednesday , November 18 2026
Breaking News

PHP Certification Exam Answers 2026 (All 100 Questions)

PHP Certification exam answers 2026: This page lists all 100 questions of the official PHP Certification exam by Itronix Solutions, each with its four answer options and the correct answer highlighted in green. Use it to revise every topic before you attempt the test and earn your verifiable certificate.

About this certification: The term PHP is an acronym for PHP: Hypertext Preprocessor. PHP is a server-side scripting language designed specifically for web development.

Certification PHP Certification
Provider Itronix Solutions
Category Programming & Development
Total questions 100 multiple-choice questions
Marks 1 mark per question (100 marks)
Passing score 80% (80 out of 100)
Retake Available if you do not pass
Certificate Verifiable online certificate

Take the exam: PHP Certification on Itronix Solutions. See every other Itronix exam in our complete list of Itronix certification answers.

PHP Exam Questions and Answers

Questions 1 to 25

1. Variable name in PHP starts with –

A. # (Hash)
B. $ (Dollar) ✔
C. ! (Exclamation)
D. & (Ampersand)

Correct answer: B. $ (Dollar)

2. Which of the following is not a variable scope in PHP?

A. Global
B. Extern ✔
C. Local
D. Static

Correct answer: B. Extern

3. Which of the following is correct to add a comment in php?

A. & …… &
B. // ……
C. /* …… */
D. Both (b) and (c) ✔

Correct answer: D. Both (b) and (c)

4. Which of the following is used for concatenation in PHP?

A. append()
B. + (plus)
C. . (dot) ✔
D. * (Asterisk)

Correct answer: C. . (dot)

5. Which of the following is the correct syntax to write a PHP code?

A. <? ?> ✔
B. < php>
C. < ? php ?>
D. <?php ?>

Correct answer: A. <? ?>

6. How to define a function in PHP?

A. function {function body}
B. function functionName(parameters) {function body} ✔
C. data type functionName(parameters) {function body}
D. functionName(parameters) {function body}

Correct answer: B. function functionName(parameters) {function body}

7. Which is the right way of declaring a variable in PHP?

A. $5_Hello
B. $3hello
C. $_hello ✔
D. $this

Correct answer: C. $_hello

8. A function in PHP which starts with __ (double underscore) is known as __________

A. Inbuilt Function
B. User Defined Function
C. Default Function
D. Magic Function ✔

Correct answer: D. Magic Function

9. Which is/are statement(s) true about PHP?

A. It is used for developing dynamic & interactive websites
B. PHP scripts execute on the server
C. It is an open-source scripting language
D. All of the above ✔

Correct answer: D. All of the above

10. PHP statements end with a ______.

A. comma (,)
B. semicolon (;) ✔
C. colon (:)
D. dot (.)

Correct answer: B. semicolon (;)

11. Which statement is commonly used for PHP output?

A. echo ✔
B. log
C. php.write
D. write

Correct answer: A. echo

12. Which PHP keyword is used to access a global variable inside the function?

A. global_variable
B. globalscope
C. php_ global
D. global ✔

Correct answer: D. global

13. Which of the following is/are a PHP code editor? Notepad Notepad++ Adobe Dreamweaver PDT

A. All of the mentioned ✔
B. Only 4
C. Only 3
D. 1, 2 and 3

Correct answer: A. All of the mentioned

14. Which version of PHP introduced Try/catch Exception?

A. PHP 4
B. PHP 5 ✔
C. PHP 5.3
D. PHP 6

Correct answer: B. PHP 5

15. Which of the below symbols is a newline character?

A. /r
B. \r
C. \n ✔
D. /n

Correct answer: C. \n

16. If $a = 12 what will be returned when ($a == 12) ? 5 : 1 is executed?

A. 1
B. 12
C. Error
D. 5 ✔

Correct answer: D. 5

17. Which of the following is the use of strpos() function in PHP?

A. The strpos() function is used to search for a character/text in a string ✔
B. The strpos() function is used to search for a capitalize character in a string
C. The strpos() function is used to search for the spaces in a string
D. The strpos() function is used to search for a number in a string

Correct answer: A. The strpos() function is used to search for a character/text in a string

18. Which of the following is the correct way to create a function in PHP?

A. Create myFunction()
B. function myFunction() ✔
C. New_function myFunction()
D. None of the above

Correct answer: B. function myFunction()

19. What is the use of fopen() function in PHP?

A. The fopen() function is used to open remote server
B. The fopen() function is used to open folders in PHP
C. The fopen() function is used to open files in PHP ✔
D. None of the above

Correct answer: C. The fopen() function is used to open files in PHP

20. What is the use of isset() function in PHP?

A. The isset() function is used to check whether the variable is string or not
B. The isset() function is used to check whether variable is set or not ✔
C. The isset() function is used to check whether the variable is free or not
D. None of the above

Correct answer: B. The isset() function is used to check whether variable is set or not

21. PHP is mainly used for:

A. Photo editing
B. Server-side web development ✔
C. Spreadsheets
D. Mobile UI design

Correct answer: B. Server-side web development

22. PHP originally stood for:

A. Programming Hypertext Processor
B. Personal Home Page ✔
C. Private HTML Pages
D. Public Host Protocol

Correct answer: B. Personal Home Page

23. PHP now recursively stands for:

A. PHP: Hypertext Preprocessor ✔
B. PHP Hosting Platform
C. Programmed HTML Pages
D. Personal Hypertext Program

Correct answer: A. PHP: Hypertext Preprocessor

24. PHP code is enclosed in:

A. <?php … ?> ✔
B. <php> … </php>
C. {{ … }}
D. <% … %>

Correct answer: A. <?php … ?>

25. PHP variables start with:

A. #
B. &
C. @
D. $ ✔

Correct answer: D. $

Questions 26 to 50

26. PHP statements end with:

A. Nothing
B. A colon
C. A semicolon ✔
D. A full stop

Correct answer: C. A semicolon

27. echo in PHP is used to:

A. Read input
B. Output text ✔
C. Connect databases
D. Declare variables

Correct answer: B. Output text

28. Which function shows detailed information about a variable?

A. echo()
B. var_dump() ✔
C. print_r only for strings
D. show()

Correct answer: B. var_dump()

29. String concatenation in PHP uses:

A. The comma only
B. The plus (+) operator
C. The & operator
D. The dot (.) operator ✔

Correct answer: D. The dot (.) operator

30. Double-quoted strings in PHP:

A. Are always faster
B. Parse variables inside them ✔
C. Cannot contain text
D. Never parse variables

Correct answer: B. Parse variables inside them

31. An indexed array can be created with:

A. array a = (1,2,3);
B. $a = <1,2,3>;
C. $a = [1, 2, 3]; ✔
D. $a = {1, 2, 3};

Correct answer: C. $a = [1, 2, 3];

32. An associative array uses:

A. No keys
B. Only objects
C. Named keys ✔
D. Only numeric keys

Correct answer: C. Named keys

33. count($arr) returns:

A. The keys
B. The number of elements in an array ✔
C. The sum
D. The first element

Correct answer: B. The number of elements in an array

34. foreach is commonly used to:

A. Loop through arrays ✔
B. Define functions
C. Connect to databases
D. Start sessions

Correct answer: A. Loop through arrays

35. isset() checks whether:

A. A function exists
B. A variable is set and not null ✔
C. A file exists
D. A variable is empty string only

Correct answer: B. A variable is set and not null

36. empty() returns true for:

A. Only arrays
B. Only strings
C. Empty or falsy values like "", 0 and null ✔
D. Only null

Correct answer: C. Empty or falsy values like "", 0 and null

37. The == operator compares:

A. Values and types strictly
B. Values with type juggling ✔
C. Only strings
D. References only

Correct answer: B. Values with type juggling

38. The === operator compares:

A. Only arrays
B. Only types
C. Only values
D. Value and type strictly ✔

Correct answer: D. Value and type strictly

39. Functions in PHP are declared with:

A. function ✔
B. func
C. def
D. method

Correct answer: A. function

40. include and require are used to:

A. Insert the contents of another PHP file ✔
B. Send email
C. Create classes
D. Start sessions

Correct answer: A. Insert the contents of another PHP file

41. require differs from include because it:

A. Runs faster always
B. Causes a fatal error if the file is missing ✔
C. Ignores missing files
D. Only warns

Correct answer: B. Causes a fatal error if the file is missing

42. $_GET contains:

A. Server variables
B. Uploaded files
C. Data from forms using POST only
D. Data sent via URL query parameters ✔

Correct answer: D. Data sent via URL query parameters

43. $_POST contains:

A. Data sent in the request body via POST ✔
B. Environment variables
C. URL parameters
D. Server details

Correct answer: A. Data sent in the request body via POST

44. $_SERVER contains:

A. Server and execution environment information ✔
B. Only form data
C. Only files
D. Only sessions

Correct answer: A. Server and execution environment information

45. $_FILES contains:

A. Information about uploaded files ✔
B. Query strings
C. Session data
D. Headers only

Correct answer: A. Information about uploaded files

46. A PHP session is started with:

A. session_start() ✔
B. session_open()
C. new Session()
D. start_session()

Correct answer: A. session_start()

47. $_SESSION stores:

A. Uploaded files
B. Data across multiple page requests for a user ✔
C. Database tables
D. Data in the URL

Correct answer: B. Data across multiple page requests for a user

48. User input must be validated and escaped to prevent:

A. Security attacks like XSS and SQL injection ✔
B. Faster loading
C. Styling issues
D. Spelling errors

Correct answer: A. Security attacks like XSS and SQL injection

49. htmlspecialchars() is used to:

A. Escape HTML special characters to prevent XSS ✔
B. Hash passwords
C. Upload files
D. Connect databases

Correct answer: A. Escape HTML special characters to prevent XSS

50. password_hash() is used to:

A. Encrypt files
B. Securely hash passwords ✔
C. Send email
D. Store sessions

Correct answer: B. Securely hash passwords

Questions 51 to 75

51. password_verify() is used to:

A. Create a hash
B. Check a password against a stored hash ✔
C. Reset sessions
D. Delete a user

Correct answer: B. Check a password against a stored hash

52. PDO stands for:

A. Public Data Output
B. PHP Database Operator
C. Personal Data Online
D. PHP Data Objects ✔

Correct answer: D. PHP Data Objects

53. Prepared statements help to:

A. Create sessions
B. Prevent SQL injection ✔
C. Upload images
D. Speed up CSS

Correct answer: B. Prevent SQL injection

54. mysqli is an extension for:

A. Sending email
B. Generating images
C. Working with MySQL databases ✔
D. Handling sessions only

Correct answer: C. Working with MySQL databases

55. Classes in PHP are defined with:

A. define
B. object
C. class ✔
D. struct

Correct answer: C. class

56. Objects are created with:

A. new ✔
B. object()
C. make
D. create

Correct answer: A. new

57. The -> operator is used to:

A. Define arrays
B. Concatenate strings
C. Access object properties and methods ✔
D. Compare values

Correct answer: C. Access object properties and methods

58. :: is used to:

A. Access static members and constants ✔
B. Comment code
C. Concatenate strings
D. Create arrays

Correct answer: A. Access static members and constants

59. __construct() is:

A. A static property
B. A destructor
C. A global function
D. The constructor method of a class ✔

Correct answer: D. The constructor method of a class

60. Visibility keywords in PHP classes are:

A. global and local
B. static only
C. open, closed and hidden
D. public, protected and private ✔

Correct answer: D. public, protected and private

61. Inheritance in PHP uses:

A. inherits
B. uses only
C. implements
D. extends ✔

Correct answer: D. extends

62. Interfaces are implemented with:

A. uses
B. implements ✔
C. extends
D. includes

Correct answer: B. implements

63. Traits in PHP allow:

A. Styling pages
B. Reusing methods across classes ✔
C. Creating sessions
D. Multiple databases

Correct answer: B. Reusing methods across classes

64. Namespaces in PHP help to:

A. Create sessions
B. Speed up loops
C. Store files
D. Avoid name collisions between classes and functions ✔

Correct answer: D. Avoid name collisions between classes and functions

65. Composer is:

A. PHP’s dependency manager ✔
B. A web server
C. A database
D. A text editor

Correct answer: A. PHP’s dependency manager

66. Laravel is:

A. A database
B. A popular PHP web framework ✔
C. A JavaScript library
D. A CSS framework

Correct answer: B. A popular PHP web framework

67. Laravel’s ORM is called:

A. Doctrine only
B. Eloquent ✔
C. Hibernate
D. Sequelize

Correct answer: B. Eloquent

68. Laravel’s templating engine is:

A. Blade ✔
B. EJS
C. Jinja
D. Twig only

Correct answer: A. Blade

69. Artisan is:

A. A database
B. A text editor
C. A web server
D. Laravel’s command-line tool ✔

Correct answer: D. Laravel’s command-line tool

70. CodeIgniter is:

A. An IDE
B. A lightweight PHP MVC framework ✔
C. A JavaScript framework
D. A database

Correct answer: B. A lightweight PHP MVC framework

71. Symfony is:

A. A browser
B. A database
C. A PHP framework and set of reusable components ✔
D. A CSS library

Correct answer: C. A PHP framework and set of reusable components

72. MVC stands for:

A. Main-Visual-Code
B. Model-View-Controller ✔
C. Module-Version-Control
D. Model-Value-Class

Correct answer: B. Model-View-Controller

73. In MVC, the Controller:

A. Stores data only
B. Handles requests and coordinates models and views ✔
C. Styles pages
D. Displays HTML only

Correct answer: B. Handles requests and coordinates models and views

74. WordPress is built with:

A. Java and Oracle
B. Ruby and Redis
C. PHP and MySQL ✔
D. Python and PostgreSQL

Correct answer: C. PHP and MySQL

75. try/catch in PHP is used to:

A. Handle exceptions ✔
B. Start sessions
C. Loop arrays
D. Define classes

Correct answer: A. Handle exceptions

Questions 76 to 100

76. header("Location: page.php") is used to:

A. Include a file
B. Redirect the browser to another page ✔
C. Start a session
D. Print text

Correct answer: B. Redirect the browser to another page

77. Output must be sent after header() calls because:

A. Sessions require it
B. It is optional
C. It is faster
D. Headers must be sent before any body output ✔

Correct answer: D. Headers must be sent before any body output

78. json_encode() converts:

A. Arrays into XML
B. PHP values into a JSON string ✔
C. Strings into numbers
D. JSON into arrays

Correct answer: B. PHP values into a JSON string

79. json_decode() converts:

A. PHP arrays into JSON
B. Strings to dates
C. Objects to strings
D. A JSON string into PHP values ✔

Correct answer: D. A JSON string into PHP values

80. date("Y-m-d") returns:

A. A timestamp only
B. The current date in year-month-day format ✔
C. The time only
D. The day name

Correct answer: B. The current date in year-month-day format

81. strlen() returns:

A. A boolean
B. An array
C. The number of words
D. The length of a string ✔

Correct answer: D. The length of a string

82. explode() splits:

A. Numbers
B. An array into a string
C. Files
D. A string into an array by a delimiter ✔

Correct answer: D. A string into an array by a delimiter

83. implode() joins:

A. Strings into an array
B. Array elements into a string ✔
C. Numbers
D. Files

Correct answer: B. Array elements into a string

84. array_push() adds:

A. Keys only
B. Elements to the end of an array ✔
C. Nothing
D. Elements to the start

Correct answer: B. Elements to the end of an array

85. in_array() checks:

A. Whether a value exists in an array ✔
B. The array length
C. The last element
D. The first key

Correct answer: A. Whether a value exists in an array

86. file_get_contents() reads:

A. Only JSON
B. Only images
C. Database rows
D. An entire file or URL into a string ✔

Correct answer: D. An entire file or URL into a string

87. Cookies in PHP are set with:

A. setcookie() ✔
B. cookie_set()
C. $_COOKIE = value only
D. new Cookie()

Correct answer: A. setcookie()

88. PHP runs on servers such as:

A. Only Node.js
B. Apache or Nginx with PHP-FPM ✔
C. Only browsers
D. Only IIS

Correct answer: B. Apache or Nginx with PHP-FPM

89. php.ini is:

A. A log file
B. A database
C. The PHP configuration file ✔
D. A template

Correct answer: C. The PHP configuration file

90. Error reporting in production should:

A. Show stack traces to users
B. Log errors without displaying them to users ✔
C. Display all errors publicly
D. Be disabled completely with no logs

Correct answer: B. Log errors without displaying them to users

91. Type declarations in PHP 7+ help to:

A. Specify expected parameter and return types ✔
B. Disable errors
C. Remove classes
D. Speed up CSS

Correct answer: A. Specify expected parameter and return types

92. The null coalescing operator ?? returns:

A. Only booleans
B. Always the right value
C. An error
D. The left value if it exists and is not null, else the right ✔

Correct answer: D. The left value if it exists and is not null, else the right

93. PHP 8 introduced features such as:

A. Named arguments, match expressions and the JIT compiler ✔
B. Removal of classes
C. No new features
D. JavaScript syntax

Correct answer: A. Named arguments, match expressions and the JIT compiler

94. The match expression in PHP 8:

A. Is a stricter, expression-based alternative to switch ✔
B. Creates classes
C. Handles sessions
D. Replaces arrays

Correct answer: A. Is a stricter, expression-based alternative to switch

95. CSRF tokens protect forms against:

A. Slow loading
B. SQL injection only
C. Spelling errors
D. Cross-site request forgery ✔

Correct answer: D. Cross-site request forgery

96. File uploads should be validated for:

A. Nothing
B. Colour
C. Type, size and safe storage location ✔
D. Font

Correct answer: C. Type, size and safe storage location

97. The main strength of PHP is:

A. Mobile game graphics
B. Spreadsheet formulas
C. Operating system kernels
D. Easy, widely supported server-side web development ✔

Correct answer: D. Easy, widely supported server-side web development

98. Single-line comments in PHP can start with:

A. % only
B. — only
C. ; only
D. // or # ✔

Correct answer: D. // or #

99. The modulus operator in PHP is:

A. //
B. mod
C. \
D. % ✔

Correct answer: D. %

100. A constant in PHP can be defined with:

A. define() or const ✔
B. var
C. final
D. let

Correct answer: A. define() or const

How to Pass the PHP Exam

  • Read every question carefully; most options look similar, so look for the most precise answer.
  • Revise the questions above topic by topic rather than memorising letters, because option order can change in the live test.
  • You need 80 correct answers out of 100 to pass, so aim to understand at least 85 to stay safe.
  • If you do not clear it on the first attempt, review the questions you missed and use the retake option.

Frequently Asked Questions

How many questions are in the PHP Certification exam?

The exam has 100 multiple-choice questions, each worth 1 mark.

What is the passing score for the PHP Certification?

You need at least 80% (80 out of 100) to pass and receive the certificate.

Can I retake the PHP Certification exam?

Yes. If you score below 80%, you can retry the test after reviewing the topics.

Is the Itronix certificate verifiable?

Yes. Every certificate issued by Itronix Solutions has a unique ID that can be checked on the Itronix verify-certificate page.

More Programming & Development Certification Answers

Disclaimer: These answers are provided for learning and revision. Questions and answers are checked regularly; if you find a mistake, let us know in the comments.

About Priya Dogra

Priya Dogra runs priyadogra.com, where she shares free certification courses, internships, jobs, scholarships and exam preparation guides for Indian students and freshers. Follow her on YouTube, LinkedIn and Instagram for the latest opportunities.

Check Also

Unix/ Linux Certification exam answers 2026

Unix/ Linux Certification Exam Answers 2026 (All 100 Questions)

All 100 Unix/ Linux Certification exam questions with correct answers highlighted - updated 2026.

Leave a Reply

Your email address will not be published. Required fields are marked *