vendredi 13 avril 2018

If two array values match then create a new array with their values

I'm new to Laravel and blades, I have a lot of information flying around my head from college days and Java but it's just not coming together. If anyone can assist I would greatly appreciate being pointed in the right direction. So, I have an array, of places times and days.

I want to parse this array with Laravel PHP, grouping any matching values (i.e. places) and putting them into their own array. So I have individual arrays arranged by place (containing the time and place so there is no duplication of "places").

Here is my code:

@foreach ($schedules as $sched)
    @if($sched == $sched)
         $newSchedule = array[$sched];
    @else
         $newSchedule = array[$sched];
@endforeach

I know that's probably not the right syntax even but I've tried many permutations. If anyone could assist and explain why, or where I'm not getting it, I would much appreciate it. Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire