In this tutorial learn how to check value if exist in array using in_array option selected, inside foreach loop with laravel view in php.
How to Checks array values if a value exists in an array, let's check Using this
USA
IN
en
fr
How to Checks array values if a value exists in an array, let's check Using this
in_array
method in LARAVEL php. go the view (blade template) in resource views folders<?php
$arrLanguages = array('USA','IN','en','fr','it','de','es','zh','ru','ro');
$arrFavLang = array('fr','en','IN','USA');?>
@foreach($arrLanguages as $language)
@if(in_array($language,$arrFavLang))
<li> {{ $language }}<li>
@endif
@endforeach
RESULT
No comments:
Post a Comment