Answer the question
In order to leave comments, you need to log in
Why return inside foreach doesn't return all values?
Good day. I'm trying to display the results of foreach, but return only returns the first value from the entire loop.
those. should get:
foreach ($products as $product) {
$name = $product['name'];
$count = $product['count'];
$id = $product['p_id'];
$output = $name . "x" . $count .";". "id товара" . $id ;
return $output;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question