A modified Naive Pettern Searching algorithn that is optimized for the cases when all characters of pattern are different
< ? php function search ( $ pat , $ txt ) { $ M = strlen ( $ pat ) ; $ N = strlen ( $ txt ) ; $ i = 0 ; while ( $ i <= $ N - $ M ) { $ j ;