Search
 
SCRIPT & CODE EXAMPLE
 

PHP

How to remove repetitive values from foreach loop in php laravel

 @foreach($sections as $section)
     <div class="form-group">
         <h2>{{ $section['section_name'] }}</h2>
         <p>{{ $section['section_description'] }}</p>
         <p>{{ $section['section_intro'] }}</p>
     </div>
     <div class="form-group ms-5">
         @php
             $questions = [];
             foreach($section['question'] as $question){
                 $questions[$question['question_name']][] = $question['question_description'];
             }
         @endphp
         @foreach($questions as $question_name=>$question_descriptions)
             <h5>{{ $question_name }}</h5>
             @foreach($question_descriptions as $question_description)
                 <p class="ms-3">{{ $question_description }}</p>
             @endforeach
         @endforeach
     </div>
 @endforeach
Comment

PREVIOUS NEXT
Code Example
Php :: subdomain ajax request fail in php 
Php :: convert php array into json online 
Php :: login with google account using php source code download 
Php :: launch new tab and refresh original page codeigniter 
Php :: customize response body with filters laravel 
Php :: sql update views +1 
Php :: $request laravel undefined inside function query 
Php :: pass yield to vue component laravel 
Php :: php echo comand 
Php :: Failed to open stream: No such file or directory in /home/southsah/public_html/wp-content/advanced-cache.php on line 22 
Php :: ifmodule condition in htaccess 
Php :: php wxplode 
Php :: trait class has consttoctor 
Php :: strrev 
Php :: woocommerce create client account without email 
Php :: concatenar 
Php :: php linkify text 
Php :: php make simple loop of number elevated to exponent without pow 
Php :: Return the union of this RDD and another one 
Php :: laravel get file size uploaded 
Php :: wprest api remove content from response 
Php :: magento 2 isSetFlag() 
Php :: <?php $a=2; if ($a1){ echo "more that 1"; }elseif{ echo "less than one"; } ? 
Php :: magento 2.4.3 how to log 
Php :: retrieve the order Id on Order pay page 
Php :: Access directory above php 
Php :: Add Payment Type to WooCommerce Admin Email 
Php :: DB::raw update query in laravel 
Php :: php like button counter 
Php :: Laravel Query: orderBy not working with groupBy (with a joined table) 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =