Hi,
If I have a string, (variable len), and I am looking for the first position
of one char in array starting from position 'x'
For example,
// the 'haystack'
$string = "PHP is great, php is ok";
// the needles
$char[] = 'P';
$char[] = 'r';
$char[] = 'k';
I would search the $string for the first $char starting from 3 and it would
return 7, (for 'g').
I could use many strpos(...) but that does not sound very efficient.
So what would be the fastest way to get the first position?
And, I am using PHP 4.x, not 5, (otherwise I guess I would use strpos(...)).
Many thanks in advance.
Simon
If I have a string, (variable len), and I am looking for the first position
of one char in array starting from position 'x'
For example,
// the 'haystack'
$string = "PHP is great, php is ok";
// the needles
$char[] = 'P';
$char[] = 'r';
$char[] = 'k';
I would search the $string for the first $char starting from 3 and it would
return 7, (for 'g').
I could use many strpos(...) but that does not sound very efficient.
So what would be the fastest way to get the first position?
And, I am using PHP 4.x, not 5, (otherwise I guess I would use strpos(...)).
Many thanks in advance.
Simon
Comment