What is the meaning of the statement of the twice multiplication operator?
How does the multiplication operator work when declared twice, for example:
$valor = 10**5;
3
1 answers
Works as exponential operator
The exponential operator is used when we want to raise some value to power, this operator is represented in PHP by ( * * ) (two asterisks).
The exponential operator has been introduced in PHP since version 5.6.
<?php
$num1 = 10;
$num2 = 2;
// 10*10
$potencia = $num1 ** num2;
echo $potencia;
/* O resultado exibido é => 100 */
In the case of your example, 10 raised to 5 10**5
would be:
10*10*10*10*10 = 100.000
2
Author: Boi Programador, 2020-04-30 13:56:56