|
Posted by Jochem Maas on 01/17/05 18:29
Vikram Vaswani wrote:
> Hi
> I have a string like this:
> ----
> Just when you begin to think the wagon of Vietnam-grounded movies is grinding to a slow halt, you’re hit squarely in the face with another one. However, while other movies depict the gory and glory of war and its effects, this centres on the psychology of troopers before they're led to battle.
> ----
> I need to know the index position of every occurrence of the pattern "the" in the string above, and replace it with something else. Specifically, I need the position of the last, first and third occurrences of "the".
>
> I'm totally lost as to how to do this. Could someone help me out?
take a look at the strpos() function, you'll need to use the third
(optional) argument, it should help you to determine the positions of
the occurances of the string you are looking for:
http://nl2.php.net/manual/en/function.strpos.php
>
> TIA,
>
> Kam
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail - You care about security. So do we.
Navigation:
[Reply to this message]
|