Hi Folks,
I'm currently creating a website that is offerred in English, Italian and Spanish and I am currently creating a user search function. The code so far is:
for ($i=0;$i<count($search_words);$i++) {
$var=$search_words[$i];
$lang_arr=array(0 => array("english", "inglés", "ingles", "inglesi"),
1 => array("spanish", "espanol", "español", "spagnolo"),
2 => array("italian", "italiano")
);
if (in_array($var,$lang_arr)) { $var=array_search($var,$lang_arr); }
$var is definitely being assigned, and is converted to lower case further up in the code to ensure there are no case-sensitivity issues. I can't really see why this isn't working, but I did wonder whether in_array() might not support multi-dimension arrays, when searching the $lang_arr ?
I have to admit, I don't use many of the wealth of array functions that are on offer as much as I should and looking at them, they make life much easier than the alternatives I may have used from time to time. Any help would be greatly appreciated.
Many Thanks,
Tom