php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6312 return of strpos and strrpos functions
Submitted: 2000-08-23 09:36 UTC Modified: 2000-08-23 09:44 UTC
From: God_is_so_good at hotmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.0 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: God_is_so_good at hotmail dot com
New email:
PHP Version: OS:

 

 [2000-08-23 09:36 UTC] God_is_so_good at hotmail dot com
i think that this is not properly a bug, but an good sugestion...

the returned values of the strpos and strrpos functions are NULL for non-matching, ZERO when the match ocurred at the first position of the string, ONE when the match ocurred at the second position, and so on. on the following sample, if $gbProcessStatus matches de "A" on the first string, the code within the if will not get run...

...
if ( strpos ( "AC", $gbProcessStatus ) ) )
{
  // do something
}
...

at my view point, a nice value returned from these functions would be ZERO or NULL for non-matching, ONE for the first match, and so on...

hope this was an useful note,
Sidney Amaral

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-23 09:44 UTC] stas@php.net
this is an expected behaviour and this is documented. This is not a bug.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Oct 11 15:00:01 2026 UTC