Forum Moderators: coopster

Message Too Old, No Replies

mb substr count() alternative

         

cantona

3:48 pm on Feb 19, 2009 (gmt 0)

10+ Year Member



Hi

I'm writing an autocomplete script and am using mb_substr_count() to count the number of substring occurrences to bring back keyword matches.

But I am only interested in having the wildcard on the right. mb_substr_count() brings back a match even if the needle is in the middle of the haystack.

Are there any other funcs I can use to specify the side of the wildcard, or would i have to use a regular expression?

----
I'm using UTF-8 data so need the multi-byte funcs.

[uk2.php.net ]

whoisgregg

4:05 pm on Feb 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi cantona,

mb_strpos [php.net] should do the trick. :)

cantona

4:28 pm on Feb 19, 2009 (gmt 0)

10+ Year Member



Thanks!