Q:

How to disregard case when searching a txt document?

I have a search box on my website that searches from a list of websites (stored in sites.txt), the list looks like this:
<a href="example.org">Example Website</a>
<a href="example.com">Another Example Website</a>

The search box uses this action to find matching results from the list:
<?php
    $q = $_REQUEST["q"];

$f = fopen("sites.txt", "r");
while (($line = fgets($f)) !== FALSE) {
   if (strstr($line, $q)) {
       print "<p>$line</p>";
   }
}
?>

How can I change the PHP to make sure that the search box input's case is ignored? 
I.E: search for 'another' returns 'Another Example Website'

A:

if (strstr($line, $q)) {

To make it case-insensitive, just change strstr() to use the stristr() (with an i) function instead.
Reference:
http://php.net/manual/en/function.stristr.php

