Re: Counting the number of occurrences (and position) of of a char in a string
From: Chung Leong (chernyshevsky_at_hotmail.com)
Date: 01/29/05
- Next message: ramiro: "Re: Which is the most stable version of PHP ?"
- Previous message: Geoff Berrow: "Re: Dynamic Pages"
- In reply to: francescomoi_at_europe.com: "Counting the number of occurrences (and position) of of a char in a string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 29 Jan 2005 12:09:52 -0500
<francescomoi@europe.com> wrote in message
news:1107010324.494830.277500@f14g2000cwb.googlegroups.com...
> Hi.
>
> I'm using 'strpos', but wonder whether this function exists:
> find_string($haystack, $needle)
> which returns an array with all the numeric positions of the
> occurrences of needle in the haystack.
>
> Thank you very much.
>
preg_match_all() with the PREG_OFFSET_CAPTURE flag. Not quite the same as a
simple text search but never hurts to have more power.
- Next message: ramiro: "Re: Which is the most stable version of PHP ?"
- Previous message: Geoff Berrow: "Re: Dynamic Pages"
- In reply to: francescomoi_at_europe.com: "Counting the number of occurrences (and position) of of a char in a string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|