= Operator
The equals to ‘=’ sign operator is used as an assignment operator. It assigns the value that is on its right side to the variable that is on its left side.
Syntax:
$variable = value
Example: Implementation to showcase the use of ‘=’ operator.
<?php
$num1 = 7;
$num2 = 8.99;
$num3 = $num1 + $num2;
echo $num3 . "\n";
$name = "w3wiki";
echo "You are on portal of " . $name . "\n";
$single = true;
echo $single . "\n";
?>
Output
15.99 You are on portal of w3wiki 1
Difference between the (=), (==), and (===) operators in PHP
In PHP, the ‘=’ operator is used for assignment, while the ‘==’ operator is used for loose equality comparison, meaning it checks if two values are equal without considering their data types. On the other hand, the ‘===’ operator is used for strict equality comparison, meaning it checks if two values are equal and of the same data type.
Contact Us