How to Checks array values if a value exists in an array,
let's check Using this
let's check Using this
in_array
method in PHP.<?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)){ echo "selected => ". $language."<br>"; } } ?>
RESULT :
selected => USA
selected => IN
selected => en
selected => fr
No comments:
Post a Comment