What does this expression mean *=

Asked

Viewed 480 times

7

I wonder what the meaning of *= both in PHP and Javascript:

I have a JS function and I’m converting to PHP, then appeared this *= but I have no idea what it does.

On the question of function is right. I would just like to understand what it is for.

$b *= 200;

1 answer

11


Simplified Answer

That’s an abbreviated form of:

$b = $b * 200;

similarly there are abbreviations for sum, division and multiplication

$b = $b - 200;
$b -= 200;
$b = $b + 200;
$b += 200;
$b = $b / 200;
$b /= 200;

More detailed answer

This is a Operador Combinado where you combine a simple assignment (passing the value of one variable to another) with an arithmetic operation with the variable that will store the assignment (the result).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.