Answer the question
In order to leave comments, you need to log in
How to display names from an array separately from each other?
Hello everyone, in general, what is the problem. I'm getting data from an array...
$names = array_column($data['data']['builder'], 'name');
$name = implode(', ', $names);
return $this->render('builders/index.html.twig', [ 'name' => $name ]);
Answer the question
In order to leave comments, you need to log in
Direct answer to the question:
You pass the string that you collected from the array into the template.
1. Pass an array at once
$this->render('builders/index.html.twig', ['names' => $names])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question