PHP Operators Interview Questions & Answers

PHP Operators Interview Questions & Answers list

Here, you can read about PHP Operators related Interview Questions & Answers. With the help of this, you can learn more about various PHP operations. Find PHP Operators FAQs for Job Preparation.

How will you concatenate two strings in PHP?

To concatenate two string variables together, use the dot (.) operator.


What is the difference between == and === Operators in PHP?

PHP equal operator (==) and idential operator (===) are Relational or Comparison Operators in PHP langauge.

The only difference is that === operator matches the values along with Data types. While == operator only match values but not Data types.


Example to see difference between both operators

We have compared the two variable one by one by using == and === Operator, we get the following result.

You will see that value is matched if used the equal operator ‘==’ and not matched if used identical operator ‘===’ because data type is not same for both numbers.

Therefore, if we need to match both values strictly with datatypes, ‘===’ operator will be used else ‘==’ will be used in PHP.