This is the string a want to process: "very, very, Random Stringby Random $10" The fixed strings are $ and the last by. I do not know how many by's it will be before the last one.
I am looking for a way to unambiguously cut out the "by Random"("by" and the string/strings between $ sign) out of string.
I though I could do this by accessing the position of $ sign(I know there will always be $ sign in there at the right position) with strpos function and the position of the first "by" before $ sign. But I don't know how to tell it to look for the first "by" before the selected position, namely the $ sign. What approach do you recommend that I take?
strripos('by', $str)would find the lastby.