hi,
i've got a variable, e.g. $test = "re: re: test" and now i want to know how often a certain string is contained in that variable, i.e. "re:"
any suggestions?
You might want to check the PHP manual, the strings section.
I asked for this last night but no-one seemed to know so I wasn't sure it was possible.
gitarrenhaendler, heres the URL...
http://www.php.net/manual/en/function.substr-count.php
(Be aware if you count the number of times hello appears, the string Hello helloworld would give an output of two. Its also case-sensitive)
I just checked this worked...
$num_re = substr_count("$test", "re:"); echo $num_re;
will give the number of re: in the variable.