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
 [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: Sat Apr 20 10:01:28 2024 UTC