Page 1 of 1

strchr confusion

Posted: Thu Mar 12, 2009 9:54 am
by Reviresco
This says that strchr finds the last occurrence of a string within a string:

http://www.php.net/manual/en/function.strrchr.php

While this says that strchr is an alias of strstr, which finds the first occurrence of a string within a string:

http://us2.php.net/manual/en/function.strchr.php

In testing it, it seems like the second one is correct. Is the first one a mistake, or was it changed at some point, or something?

Re: strchr confusion

Posted: Thu Mar 12, 2009 10:05 am
by JeffG
The documentation is correct in both cases, but you mis-read the first one. strchr and strrchr are two different functions.

Re: strchr confusion

Posted: Thu Mar 12, 2009 10:14 am
by Reviresco
Ah, that extra "r". Need to put my glasses on.