php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13533 new function
Submitted: 2001-10-03 17:20 UTC Modified: 2010-12-14 12:33 UTC
From: e at arix dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
37 - 18 = ?
Subscribe to this entry?

 
 [2001-10-03 17:20 UTC] e at arix dot com
would just like to suggest creating a new function (perhaps called strset) that takes a haystack as its first parameter and a string of needles i.e. a string each of whose characters will be looked for in the haystack.  finding ANY of those characters the function should return the index.

would be very useful to have this.

- erick

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-28 21:12 UTC] yohgaki@php.net
Could you explain more clearly with examples?
 [2002-01-28 21:29 UTC] e at arix dot com
strset("This is a sample haystack", "ixbt") returns 3 because "i" was found in the haystack.

strset("This is a sample haystack", "xbt") returns 0 because none of the characters in "xbt" are found in the haystack

strset("This is a sample haystack", "xbts") returns 4 because it finds it at the end of "this"

syntax: strset(haystack, needles)

essentially strset is a function that iterates through the needles testing for the presence of each in the haystack.
 [2010-12-14 12:33 UTC] jani@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2010-12-14 12:33 UTC] jani@php.net
preg_match() and PREG_OFFSET_CAPTURE helps. No need for yet another very seldomly needed string function here.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 00:01:30 2024 UTC