yeah, like strpos() you still could have gotten from the manual.

strncmp() does it exactly, like strpos() but only searches the beginning,
note that it returns false for matching strings for use in some sorting functions.

   $testip = "150.200.250.x";
   $match = "150.200.250.";

   if (!strncmp($testip, $match, strlen($match)))
      echo("ok, " . $testip . " matches");


On Wed, 16 Jan 2002 10:58:16 -0800 (PST), Police Trainee wrote:

>nah, there's another one that you don't have to
>speficy the length. i remember seeing it used once
>when checking the user's browser to see if the string
>"mozilla" was contained within the variable...
>besides, i changed the string to check for by one
>digit and it still returned true because PART of the
>string was true i guess... i dunno.
>anyone else got another function in mind?
>> strncmp()
>> bvr.

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to