From PHP 5.6
we now have the possibility to invoke or declare a function, stating that the arguments are infinite, using the ...
operator.
Example:
function add(... $arguments)
{
return array_sum($arguments);
}
add(1, 2, 3); // imprime: 6
Example 2:
print_r(...[$object, false]);
// é equivalente a:
print_r($object, false);
I asked a question related to variadic functions where the advantages of using it are explained.
But I do not know the name of this operator used in variadic funcion
, that of the ...
operator.
I often talk with reluctance. But I do not know if I'm right.
What is the correct name for this operator?