php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25909 strpos
Submitted: 2003-10-19 06:29 UTC Modified: 2003-10-19 07:50 UTC
From: zygimantas at skylords dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.3.2 OS: RH7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zygimantas at skylords dot com
New email:
PHP Version: OS:

 

 [2003-10-19 06:29 UTC] zygimantas at skylords dot com
Description:
------------
strpos fails when array is used as needle.



Reproduce code:
---------------
$i = 2;
$str_word = 'sentence with word2';
$arr_letters = array('word1', 'word2', 'word3');

echo strpos($str_word, $arr_letters[$i]);

Expected result:
----------------
null


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-19 07:50 UTC] sniper@php.net
The function works properly when it returns 'false' as the haystack string does not contain string 'word3' in it.

Hint: Array indices start from 0 (zero).

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 09:01:34 2025 UTC