Jump to content

Case sensitive strpos


eon201

Recommended Posts

Im searchina string for the characters ' PIN='. It works and pulls up the what I have searched for.

 

The only problem is that it is also pulling up ' pin=' -notice the non caps

 

Why is this? Can I force the function to be case sensitive?

 

$findme22 = ' PIN=';
$pinfinder = strpos($line, $findme22);

 

Thanks. Eon201 ;D

Link to comment
Share on other sites

Another quick question about these two functions mentioned above.

 

When seaching for a pattern in the string, will php pick up on the fact that I am looking for ' PIN=' or will it automatically ignore the whitespace???

 

This is very important in my search criteria.

Is there some syntax that is specific to whitespace when using php??

 

Thanks. Eon201

Link to comment
Share on other sites

Another quick question about these two functions mentioned above.

 

When seaching for a pattern in the string, will php pick up on the fact that I am looking for ' PIN=' or will it automatically ignore the whitespace???

 

The manual doesn't say anything about whitespace specifically, but as it matches full strings, it's logical that the spaces will be matched as well. If you get into a situation where you are needing to actually match a true pattern rather than a static string, use preg_match() instead so you can use regular expressions to define your pattern criteria.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.