I am reading a string from a database that is composed of commas separated items,eg
3.99,10 weeks,300
That is not the problem. So I explode this:
$fn = array(explode(",",$im->features));
to get the individual items for the array.
But when I loop through it
@foreach($fn as $fun)
{{$fun}}<br>
@endforeach
(The {{}} and @ are because this is Laravel) I get the following error:
htmlspecialchars(): Argument #1 ($string) must be of type string, array given
Any help gratefully appreciated
2
Answers
I have solved it. Silly mistake. I put
instead of
You can try the following:
Note that if you want to display specific parts of each item, you will need to explode each individual item again (not sure if you need this). But you can achieve it as follows: