title: Laravel 6.2- Using @php ...-. @endphp does not work but <?php ---- ?> does?
body: <p>I was trying to use @php....@endphp to code some data in a Laravel blade file as follows</p>
  <pre><code>&lt;div class=&quot;row&quot;&gt;
                    @php
                           $count =count($doc_list);
                              if(!empty($chk_doc_list)){
                                  $arrColumns = array_column($chk_doc_list,'docType');
                             }
                          @endphp
                           @for($i=0;$i&lt;$count;$i+=2)
                           @php
                             $c1=$i;$c2=$c1+1;
                             $n1=$c1+1;
                             $n2=$c2+1;
                           @endphp
                        &lt;div class=&quot;col-md-6&quot;&gt;
                        &lt;div class=&quot;row listview&quot;&gt;
                            &lt;div class=&quot;col-md-11&quot;&gt;
                              {{$n1}}. {{$doc_list[$c1]-&gt;TDM_Doc_Name}}
                           &lt;/div&gt;
                            &lt;div class=&quot;col-md-1 listicon&quot;&gt;
                               @if(!empty($arrColumns))
                                  @if(in_array($doc_list[$c1]-&gt;TDM_Doc,$arrColumns))
                                    &lt;i class=&quot;fa fa-check text-success&quot;&gt;&lt;/i&gt; 
                                  @endif
                               @endif
                            
  
                              &lt;!-- &lt;label&gt;&lt;input type=&quot;checkbox&quot; class=&quot;minimal&quot;&gt;&lt;/label&gt; --&gt;
                            
                            &lt;/div&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                      @if($c2&lt;$count)
                       &lt;div class=&quot;col-md-6&quot;&gt;
                          &lt;div class=&quot;row listview&quot;&gt;
                              &lt;div class=&quot;col-md-11&quot;&gt;
                              
                                  {{$n2}}. {{$doc_list[$c2]-&gt;TDM_Doc_Name}}
                                
                              &lt;/div&gt;
                              &lt;div class=&quot;col-md-1 listicon&quot;&gt;
                                @if(!empty($arrColumns))
                                  @if(in_array($doc_list[$c2]-&gt;TDM_Doc,$arrColumns)) 
                                  &lt;i class=&quot;fa fa-check text-success&quot;&gt;&lt;/i&gt; 
                                  @endif 
                                @endif
  
                                &lt;!-- &lt;label&gt;&lt;input type=&quot;checkbox&quot; class=&quot;minimal&quot;&gt;&lt;/label&gt; --&gt;
                             
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                    @endif
                  @endfor
                    &lt;/div&gt;
  </code></pre>
  <p>However, the code didnt work. The browser (I tried with 4 of them) was unable to identify <code>$count</code> in  <code> @for($i=0;$i&lt;$count;$i+=2)</code> line.</p>
  <p>But, when I changed <code>@php</code> to <code>&lt;?php</code> and <code>@endphp</code> to <code>?&gt;</code> ,it worked.
  So, what was the problem with the first one?</p>