Tricky PHP question, i need the pros?

Jim

New member
Ok pros i need you help, have been trying this for ages, maybe simple i can't do it though.

If i want to check for an occurance of a string in some text i can use,

strpos($some_string,"word"); this return first char position of the string.

but what if i want to search for the occurance of a string between a set starting point and end point in the text.

so if the $text was = "hello my name is fred blogs and i live in a house"

so strpos($text,"fred"); would give about 18

what if i had $text = "hello my name is fred blogs and i live have a brother fred as well and a granda called fred as well"

now i know that the 2nd "fred" in this string lies between positions A & B so do you strpos between these two positions?
 
Back
Top