samedi 25 juin 2016

Laravel - loop on array

I have statement like this :

result:
0:{
    commentContent:"foo"
}
1:{
    commentContent:"bar"
}

I want to add number of result array to commentContent. Here is what I want :

result:
0:{
    commentContent:"foo0"
}
1:{
    commentContent:"bar1"
}

At this moment, here is I have : (Literally it's not correct)

$commentList[0]['commentContent'] = $commentList[0]['commentContent']+'0';
$commentList[1]['commentContent'] = $commentList[1]['commentContent']+'1';

How to do this in Laravel controller with foreach?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28UzNxB
via IFTTT

Aucun commentaire:

Enregistrer un commentaire