c q
08-07-2002, 05:26 PM
Hii
I yeaaa it sound funny why anyone would want to do that...but some function I got requires it.
so,
how can I count the number of times a particular characher occurs in a given string ?
I tried using preg_match, and ereg, but they work only if the character repeats itself as in aaaaa, but not as in asacaval
well, here's my code...
<?php
print($REDIRECT_URL);
print("<BR> number of slashes.. ");
print ereg("/", $REDIRECT_URL, $array);
?>
the output for. eg. is...
/cbit/template.php/
number of slashes.. 1
I thought there were three of them in this string.
Maybe I'm using the wrong function altogether.
suggestions ??
I yeaaa it sound funny why anyone would want to do that...but some function I got requires it.
so,
how can I count the number of times a particular characher occurs in a given string ?
I tried using preg_match, and ereg, but they work only if the character repeats itself as in aaaaa, but not as in asacaval
well, here's my code...
<?php
print($REDIRECT_URL);
print("<BR> number of slashes.. ");
print ereg("/", $REDIRECT_URL, $array);
?>
the output for. eg. is...
/cbit/template.php/
number of slashes.. 1
I thought there were three of them in this string.
Maybe I'm using the wrong function altogether.
suggestions ??