Jump to content

[SOLVED] Search string for character at certain position


Recommended Posts

Hey guys,

 

Have this at the moment:

 

if (preg_match("/a/i", $variable)) {
      $result++;
}

 

If the variable has the letter a in it (not case sensitive), add one to the result. Works fine, however i only want to see if only the second character in the string has the letter a, not go through the whole string. Any suggestions?

 

Cheers

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.