I have a variable that is being defined as
$var .= "value";
How does the use of the dot equal function?
Operators are used to perform operations on variables and values. PHP divides the operators in the following groups: Arithmetic operators. Assignment operators. Comparison operators.
In PHP, the double colon :: is defined as Scope Resolution Operator. It used when when we want to access constants, properties and methods defined at class level. When referring to these items outside class definition, name of class is used along with scope resolution operator.
The spaceship operator <=> is the latest comparison operator added in PHP 7. It is a non-associative binary operator with the same precedence as equality operators ( == , !=
PHP && Operator The logical operator && returns: TRUE only if both of its operands evaluate to true. FALSE if either or both of its operands evaluate to false.
It's the concatenating assignment operator. It works similarly to:
$var = $var . "value";
$x .=
differs from $x = $x .
in that the former is in-place, but the latter re-assigns $x
.
This is for concatenation
$var = "test"; $var .= "value"; echo $var; // this will give you testvalue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With