Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Difference between Single Equal, Double Equal, Triple Equal, Not Equal, and Not Identical in PHP?

Single Equal

It is Known as Assignment Operator means it assigns a constant value in a variable. For Example : A Constant Value (10) is assigned to the variable $num1, it prints the assigned value when echo called. See the Program Below:-

Sample Program

Output

Double Equal

It compares two variables or Operators and gives the Output whether it is True or False.

Case 1. When Both the operants have the same value then it returns True. (Note: Only Value need to be same not Datatype)

Case 2. When Both the operants have a different Value then it returns False.

Note :- It prints 1 for True and for False it can’t prints.

Sample Program

Output

Triple Equal

It compares two variables or Operators and gives Output whether it is True or False by Comparing the Value and Datatype both.

Case 1. When Both the operants have the same Value and Datatype then it returns True. (Note: It Compares Value and Datatype Both.)

Case 2. When Both the operants have the Same value but Different datatype then it returns False.

Case 3. When Both the operants have the Different value but Same datatype then it also returns False.

Case 4. When Both the operants have the Different value as well as datatype then it also returns False.

Sample Program(Case 1)

Output

Sample Program(Case 2)

Output

Sample Program(Case 3)

Output

Sample Program(Case 4)

Output

Difference between Not Equal and Not Identical in PHP.

It Compares two variable, when the variables are not equal then it returns True either False. For Example-

5!=2 (5 does not equal to 2), it returns True because 5 is not equal to 2, means statement is true. So it returns true and prints 1.

Sample Program

Output

Not Identical

It returns True if $a is not equal to $b, or they are not of the same Datatype. For Example:-

$a !==$b , It returns True when either value of $a does not equal to $b or Datatype of $a and $b are different. If any of two statements matched then it returns True.

Sample Program

Output

In the above Program, Datatype of the variables are the same but Value of variables are different (any one statement matched) So it returns True.

Spaceship Operator

It returns -1, 0, 1 when $a is respectively less than, equal to, or greater than $b. It also compares String by their ASCII value. For Example:- $a<=>$b

Sample Program(Constant Value)

Output

Sample Program(String)

Output

Click here for Next part :-

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
With MotoShare.in, you can book a bike instantly, enjoy doorstep delivery, and ride without worries. Perfect for travelers, professionals, and adventure enthusiasts looking for a seamless mobility solution.

Related Posts

What is CodeIgniter and use cases of CodeIgniter?

What is CodeIgniter? CodeIgniter is an open-source PHP web application framework designed to simplify and accelerate web development. It follows the Model-View-Controller (MVC) architectural pattern and provides…

Read More

What is PHP and use cases of PHP?

What is PHP? Are you wondering what PHP is and how it works? Look no further! In this article, we will explore the ins and outs of…

Read More

Complete guide on PHP certification courses, tutorials & training

What is PHP Hypertext Preprocessor is known as PHP. Many developers use PHP, an open-source server-side programming language, to create websites. In addition, it is a general-purpose…

Read More

Complete PHP with Laravel Certification Guide & tutorials

What is PHP with Laravel? PHP was visioned eventually in the fall of 1994 by Rasmus Lerdorf. PHP means Hypertext Preprocessor. It’s a extensively- used, open source…

Read More

Top 50 PHP Interview Questions and Answers

1) What is PHP? PHP is an open-source, interpreted, and object-oriented scripting language that can be executed at the server-side. PHP is well suited for web development….

Read More

Complete guide of PHP certification courses, tutorials & training

PHP is a great beginner programming language for anyone who is wanting to cross over into the coding world. Though easy to learn, it is an extremely…

Read More