Posted: Wed Apr 04, 2007 6:04 pm
Somehow, I missed this part of your post...
and then just using $precolon[0] where I need the string works okay... so, the question is whether strpos() is a better way to do it, and if so, how to make it work for getting all text before a given character?
Looking on the manual page for strpos() there are examples for getting text from between two strings... would I take that sort of approach and just use -1 as the starting position and ":" as the ending string?
I guess the issue is that I don't really need to know where it is, or if there is more than one ":" -- I just need to be able to get at everything that precedes the ":" -- so usingEverah wrote:You really can't do anything about it without knowing where it is or going after it in some capacity. You can use regexp or you can use strpos() if you know there will only be one colon in the string.
Code: Select all
$precolon = explode(":", $books[2]);Looking on the manual page for strpos() there are examples for getting text from between two strings... would I take that sort of approach and just use -1 as the starting position and ":" as the ending string?