strchr confusion

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Reviresco
Forum Contributor
Posts: 172
Joined: Tue Feb 19, 2008 4:18 pm
Location: Milwaukee

strchr confusion

Post 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?
JeffG
Forum Commoner
Posts: 35
Joined: Wed Jan 30, 2008 1:42 pm
Location: Newbury, UK

Re: strchr confusion

Post by JeffG »

The documentation is correct in both cases, but you mis-read the first one. strchr and strrchr are two different functions.
Reviresco
Forum Contributor
Posts: 172
Joined: Tue Feb 19, 2008 4:18 pm
Location: Milwaukee

Re: strchr confusion

Post by Reviresco »

Ah, that extra "r". Need to put my glasses on.
Post Reply