PHP and javascript snippets you can copy and paste.

Thursday, March 15, 2007

str_conv_strToLowerCaseArray($separator,$s)

/**
* strToLowerCaseArray
*
* Converts a string to an array where each element is lowercase.
* @param $separator - char to separate the string with.
* @param $s - string.
* @return array.
*/
function str_conv_strToLowerCaseArray($separator,$s){
$arr = explode($separator,$s);
while(list($key,$val) = each($arr)){
$arr[$key] = strtolower(trim($val));
}
return $arr;
}

No comments: