24 real Core Language & Types questions from the PHP bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.
1. What is Type juggling?
Junior
A.PHP's automatic conversion of a value from one scalar type to another depending on the operator or context in which the value is used
B.a per-file declare statement that turns off coercion of scalar arguments so a mismatched type throws a TypeError instead of being silently converted
C.a three-way comparison written as less-than equals greater-than that returns -1, 0, or 1 depending on whether the left side is smaller, equal to, or larger than the right
D.compares both value and type, returning true only when operands match without any coercion, written as a triple equals sign
2. Which term means: "PHP's automatic conversion of a value from one scalar type to another depending on the operator or context in which the value is used"?
A.Type juggling — PHP's automatic conversion of a value from one scalar type to another depending on the operator or context in which the value is used
B.Type juggling — compares two operands for equal value after type coercion, written as a double equals sign
C.Type juggling — a three-way comparison written as less-than equals greater-than that returns -1, 0, or 1 depending on whether the left side is smaller, equal to, or larger than the right
D.Type juggling — returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
A.a hint such as int, float, string, or bool placed on a function parameter or return so the engine validates or coerces the passed value
B.the version-8 fix where comparing a number with a non-numeric string now casts the number to string rather than the string to zero, so 0 equals the word foo is finally false
C.compares both value and type, returning true only when operands match without any coercion, written as a triple equals sign
D.returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
A.Identical operator — PHP's automatic conversion of a value from one scalar type to another depending on the operator or context in which the value is used
B.Identical operator — compares two operands for equal value after type coercion, written as a double equals sign
C.Identical operator — a hint such as int, float, string, or bool placed on a function parameter or return so the engine validates or coerces the passed value
D.Identical operator — compares both value and type, returning true only when operands match without any coercion, written as a triple equals sign
A.a per-file declare statement that turns off coercion of scalar arguments so a mismatched type throws a TypeError instead of being silently converted
B.a three-way comparison written as less-than equals greater-than that returns -1, 0, or 1 depending on whether the left side is smaller, equal to, or larger than the right
C.returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
D.compares two operands for equal value after type coercion, written as a double equals sign
A.Loose equality operator — PHP's automatic conversion of a value from one scalar type to another depending on the operator or context in which the value is used
B.Loose equality operator — compares two operands for equal value after type coercion, written as a double equals sign
C.Loose equality operator — compares both value and type, returning true only when operands match without any coercion, written as a triple equals sign
D.Loose equality operator — a per-file declare statement that turns off coercion of scalar arguments so a mismatched type throws a TypeError instead of being silently converted
A.the version-8 fix where comparing a number with a non-numeric string now casts the number to string rather than the string to zero, so 0 equals the word foo is finally false
B.returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
C.compares both value and type, returning true only when operands match without any coercion, written as a triple equals sign
D.PHP's automatic conversion of a value from one scalar type to another depending on the operator or context in which the value is used
11. Which term means: "returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices"?
A.Null coalescing operator — returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
B.Null coalescing operator — a three-way comparison written as less-than equals greater-than that returns -1, 0, or 1 depending on whether the left side is smaller, equal to, or larger than the right
C.Null coalescing operator — a hint such as int, float, string, or bool placed on a function parameter or return so the engine validates or coerces the passed value
D.Null coalescing operator — compares two operands for equal value after type coercion, written as a double equals sign
A.a per-file declare statement that turns off coercion of scalar arguments so a mismatched type throws a TypeError instead of being silently converted
B.a hint such as int, float, string, or bool placed on a function parameter or return so the engine validates or coerces the passed value
C.compares both value and type, returning true only when operands match without any coercion, written as a triple equals sign
D.a three-way comparison written as less-than equals greater-than that returns -1, 0, or 1 depending on whether the left side is smaller, equal to, or larger than the right
14. Which term means: "a three-way comparison written as less-than equals greater-than that returns -1, 0, or 1 depending on whether the left side is smaller, equal to, or larger than the right"?
A.Spaceship operator — compares two operands for equal value after type coercion, written as a double equals sign
B.Spaceship operator — a three-way comparison written as less-than equals greater-than that returns -1, 0, or 1 depending on whether the left side is smaller, equal to, or larger than the right
C.Spaceship operator — returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
D.Spaceship operator — a per-file declare statement that turns off coercion of scalar arguments so a mismatched type throws a TypeError instead of being silently converted
A.returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
B.the version-8 fix where comparing a number with a non-numeric string now casts the number to string rather than the string to zero, so 0 equals the word foo is finally false
C.PHP's automatic conversion of a value from one scalar type to another depending on the operator or context in which the value is used
D.a hint such as int, float, string, or bool placed on a function parameter or return so the engine validates or coerces the passed value
17. Which term means: "a hint such as int, float, string, or bool placed on a function parameter or return so the engine validates or coerces the passed value"?
A.Scalar type declaration — returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
B.Scalar type declaration — a hint such as int, float, string, or bool placed on a function parameter or return so the engine validates or coerces the passed value
C.Scalar type declaration — compares both value and type, returning true only when operands match without any coercion, written as a triple equals sign
D.Scalar type declaration — the version-8 fix where comparing a number with a non-numeric string now casts the number to string rather than the string to zero, so 0 equals the word foo is finally false
A.a per-file declare statement that turns off coercion of scalar arguments so a mismatched type throws a TypeError instead of being silently converted
B.compares two operands for equal value after type coercion, written as a double equals sign
C.returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
D.a three-way comparison written as less-than equals greater-than that returns -1, 0, or 1 depending on whether the left side is smaller, equal to, or larger than the right
20. Which term means: "a per-file declare statement that turns off coercion of scalar arguments so a mismatched type throws a TypeError instead of being silently converted"?
A.Strict types directive — a hint such as int, float, string, or bool placed on a function parameter or return so the engine validates or coerces the passed value
B.Strict types directive — PHP's automatic conversion of a value from one scalar type to another depending on the operator or context in which the value is used
C.Strict types directive — a per-file declare statement that turns off coercion of scalar arguments so a mismatched type throws a TypeError instead of being silently converted
D.Strict types directive — returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
22. What is Numeric string comparison change in PHP 8?
Senior
A.returns its left operand when that operand exists and is not null, otherwise returns the right operand, and suppresses undefined-variable notices
B.the version-8 fix where comparing a number with a non-numeric string now casts the number to string rather than the string to zero, so 0 equals the word foo is finally false
C.a hint such as int, float, string, or bool placed on a function parameter or return so the engine validates or coerces the passed value
D.a per-file declare statement that turns off coercion of scalar arguments so a mismatched type throws a TypeError instead of being silently converted
23. Which term means: "the version-8 fix where comparing a number with a non-numeric string now casts the number to string rather than the string to zero, so 0 equals the word foo is finally false"?
A.Numeric string comparison change in PHP 8 — the version-8 fix where comparing a number with a non-numeric string now casts the number to string rather than the string to zero, so 0 equals the word foo is finally false
B.Numeric string comparison change in PHP 8 — compares two operands for equal value after type coercion, written as a double equals sign
C.Numeric string comparison change in PHP 8 — PHP's automatic conversion of a value from one scalar type to another depending on the operator or context in which the value is used
D.Numeric string comparison change in PHP 8 — a hint such as int, float, string, or bool placed on a function parameter or return so the engine validates or coerces the passed value
Answers, AI explanations, and a scored voice mock interview
Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.