String append in for each loop on laravel - development

String append in for each loop on laravel

I’m using a for each loop and fetching the value into the variable crosslisted_courses and also appending the next values in the loop into it, but the value does not gets appended!! The variable only stores the last fetched value

Have used .= to append the string !!

@foreach($fmfacactinss as $fmfacactins_slave)                                                                                                                                              

@if(($fmfacactins_slave->xlist_ctrl_crn == $master_crn) && ($fmfacactins_slave->crn <> $master_crn) ) 
@php  
$crosslisted_courses = '';                                                                                
$slave_crn=$fmfacactins_slave->crn;                                                                                
$crosslisted_courses .= $fmfacactins_slave->crs_subj_cd . ' ' . 
$fmfacactins_slave->crs_nbr . ' ' . $fmfacactins_slave->sect_nbr . ' ';                                                                                
echo($crosslisted_courses);                                                                                
@endphp
@endforeach



from Laravel Questions and Answers https://laravelquestions.com/php/string-append-in-for-each-loop-on-laravel/
via Lzo Media

Comments

Popular posts from this blog

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"? - development

CORS issue between web/android/ios

Angular.js ng-click with mouse middle button