superedit-array_isearch.php 567 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. //VERSION 2010-01-12
  3. function array_isearch($str, $array){
  4. $found = array();
  5. foreach ($array as $k => $v) {
  6. if(strstr(strtolower($v), strtolower($str))) $found[] = $k;
  7. // echo "$v like $str \n";
  8. }
  9. return $found;
  10. }
  11. function array_isearch_file($str, $array){
  12. $found = array();
  13. foreach ($array as $k => $v) {
  14. // if(strstr(strtolower($v), strtolower($str))) $found[] = $k;
  15. $matches="";
  16. preg_match(strtolower($str), strtolower($v), $matches);
  17. if($matches) $found[]=$k;
  18. // echo "$v like $str \n";
  19. }
  20. return $found;
  21. }
  22. ?>