I have a funny problem with Laravel 5.2. I have a chunck of text that I'm trying to display with some explodes. The problem is that Laravel is rendering a bit strange, putting some wrong ':' before the end of the foreach loop.
This is the code sample from blade template:
<ul class="list-unstyled">
@foreach(explode('),',$items[0]->chunk) as $text)
<li>{{ str_replace('(',' : ',str_replace(')','',$text) }}</li>
@endforeach
</ul>
And this is the version that Laravel is rendering for it:
<ul class="list-unstyled">
<?php foreach(explode('),',$items[0]->chunck): ?> as $text)
<li><?php echo e(str_replace('(',' : ',$text)); ?></li>
<?php endforeach; ?>
</ul>
I'm using NetBeans 8.0.2 as code editor (if that matters). Is there any problem with my code?
Note: If I manually edit the rendered view and move the ending PHP tag after foreach like so...
<ul class="list-unstyled">
<?php foreach(explode('),',$items[0]->chunck) as $text): ?>
<li><?php echo e(str_replace('(',' : ',$text)); ?></li>
<?php endforeach; ?>
</ul>
...it works perfectly!
Edit: It seems to be a problem reading my ')' inside explode