Return string segment based on strings

kekface

New Member
How would you return part of a string based on the contents of the string in php. Unlike substr() and related functions where you use an integer lengthSo if we are given a string like this \[code\]here is a nice string that is being used as an example\[/code\]How could we return a string like this\[code\]nice string\[/code\]Somehow we have to pass the function \[code\]a\[/code\] and \[code\]that\[/code\] so it knows the start and end point. It will find the first \[code\]a\[/code\] and then start keeping track of characters then when it finds \[code\]that\[/code\] it will stop, and return.To be clear: we know the contents of the original string... and the arguments sent.
 
Back
Top