Position in a string ?!?!?!
Posted: Tue Jan 25, 2005 11:02 am
I have done this n*n*n*n*n times in JavaScript and realy dont get how there is no function to work with it in php ?!?!
I have a string ex.
I need php to check for "," commas ( I tried preg_match() and preg_match_all() ) but also (somehow) to show the index number in the string where the pattern is found.
Now this is not so hard with one-letter pattern, but how to do it with 2,3,4,5 long patterns ( I need the index number of the first character in the pattern found ).
There probably is simple solution - I looked at the almighty Doc. - and turned to other deities - You guys, and gals
Sample ( part's ) of code wellcome !
Thanks in ahead !
I have a string ex.
Code: Select all
$stringster = "first_word, second_word, third_word, forth_word, last_word";Now this is not so hard with one-letter pattern, but how to do it with 2,3,4,5 long patterns ( I need the index number of the first character in the pattern found ).
There probably is simple solution - I looked at the almighty Doc. - and turned to other deities - You guys, and gals
Sample ( part's ) of code wellcome !
Thanks in ahead !