php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46725 strpos extensions with array type parameters
Submitted: 2008-12-01 15:28 UTC Modified: -
Votes:5
Avg. Score:4.2 ± 1.6
Reproduced:3 of 4 (75.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: php at pk dot freesurf dot fr Assigned:
Status: Open Package: Feature/Change Request
PHP Version: 5.2.6 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-12-01 15:28 UTC] php at pk dot freesurf dot fr
Description:
------------
a) strpos($haystack, $t_needle, $offset) will return position of the first $t_needle element found ...

b) strpos($t_haystack, $t_needle, $t_offset) will return an array of corresponding position...

the a) will be very usefull for me ( very cpu time consuming when $t_haystack is about 1 MB and sizeof($t_needle) is great, the haystack is to be scan as many times as the sizeof($t_needle) when I do this within a loop with the current strpos implementation).
Then proposal will need only 1 time scanning ... and it could be possible to optimize the search by pre-scanning the $t_needle array and generate an "automate" that will search for 1 character and then the 2nd one to be just after, and so on...

the b) suggestion is only for the code "beauty"...

(forgive my poor english, I'm french...)


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 07:01:29 2024 UTC