Reputation: 5117
If i have some variables like $val1, $val2, $val3, ... and convert to arr
$arr = ['val1' => $val1, 'val2' => $val2, 'val3' => $val3,..];
is it possible to define a shortly this array like this?
$arr = a('val1', 'val2', 'val3', ..)
Upvotes: 0
Views: 39
Reputation: 649
If keys are not important, you may write
$arr = [$val1, $val2, $val3];
or
$arr = array($val1, $val2, $val3);
Upvotes: 1