This question already has an answer here:
- Meaning of Three dot (…) in PHP 6 answers
- Reference — What does this symbol mean in PHP? 18 answers
Start to explore new CakePHP 3 installation today. I saw the following function in the controller in CakePHP 3 with the new installation.
class PagesController extends AppController {
public function display(...$path) {
print($path);
}
}
The printed result is as following:
Array (
[0] => home
)
The home
value comes from the following routing definition.
$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
My question is what does the ...
sign before the parameter $path
variable do? I have never seen that technique before.
</div>