If you want a function to return all text in a string up to the Nth occurrence of a substring, try the below function. Works in <
strong>PHP
strong> >= 5. (Pommef provided another sample function for this purpose below, but I believe it is incorrect.) <?<
strong>php
strong> // Returns ...