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 Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or 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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 01:01:30 2024 UTC