1
1
1mb2018-02-23 19:58:41
PHP
1mb, 2018-02-23 19:58:41

How to pass the contents of an array to the class constructor?

The class constructor accepts multidimensional arrays in the form:

$obj = new Class([
['data' => 'foo', 'data2' => 'bar']
], [
['data' => 'foo', 'data2' => 'bar']
]);

And there is a multidimensional array in the form:
$array = ;

How to pass the contents of the array $array to the class constructor?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-02-23
@1mb

splat operator

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question