Re: Please help wit{h array search technique?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: Please help wit{h array search technique?

From: Faree <th.vijaya@gmail.com>
Date: Thu Sep 29 2005 - 07:50:22 CEST

$diff=50;//Set this to Maximum difference u can allow between numbers.
        for($X=count($_AV);$X>=0;$X--)
   {
              if ($_AV[$X]== $arg)
             {
                $result=$X;
                break;
            }

           else if(($_AV[$X]<$arg) AND ($arg-$_AV[$X] <=$diff)
            {
             $result=$X;
                break;
           }

 else if(($_AV[$X]>$arg) AND ($_AV[$X]-$arg<=$diff)
            {
             $result=$X;
                break;
           }
   else echo "No Matych found wth in this limit";

}

                                      Hope this will work for u.
Received on Tue Oct 18 02:29:20 2005