Answer the question
In order to leave comments, you need to log in
How to group array values into a variable?
How to group the values of the array into one variable from this array, in the end I want to get 1,2,3.
$this->allInput = $request->all();
$arrIDsOrder = [];
$ordersInput = $this->allInput['orders'];
foreach ($ordersInput as $item) {
$arrIDsOrder[] = $item['id'];
$this->allArray = $item['id'];
}
dump($arrIDsOrder);
Answer the question
In order to leave comments, you need to log in
If we are talking about transforming an array into a variable, there is an implode
$array = array('имя', 'почта', 'телефон');
$comma_separated = implode(",", $array);
$this->allInput = $request->all();
$string = implode(",", $this->allInput['orders']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question