I am looking to count the number of occurrences of "x" before a certain point in a string.
Eg. count all values that = x before the 5th character.
Any pointers on how to achieve this would be greatly appreciated!
by this substr_count
yo can do:
substr_count($text, 'x', 0,5);
where 0
is offset
where your start, and 5
is the length
.