How to use PHP strpos not case sensitive? -
i have made php script searches whole directory text files in it, works fine, except case sensitive. how search without being case sensitive? here's code have far:
<?php $query = $_post['search']; if ($handle = opendir('posts')) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { echo "<p>$entry "; $file = file_get_contents('posts/'.$entry, file_use_include_path); $check_str = strpos($file,$query); if ($check_str == 0) { print "not found</p>"; } else { print "found</p>"; } } } closedir($handle); } ?>
yeah, stripos()
you're looking for. here's the manual page.
Comments
Post a Comment