Hello,
Would it be possible to make a script that checks if a certain character is found in a line? Like this:
String:
"Random text this is more random text and
the important character is right after this
next sentence right this is just some
random filler text |"
So the | is the important character.
How could I make a script that checks if the line contains the important character?
In more advanced terms, and probably another topic altogether;
How could I make something that checks for a character (a string) and echo everything up from that until the important character is found?
Like this:
$string = "before stuff 12345 This is the string this is the string | after stuff";
$check1 = strstr($string, '12345');
echo everything from the characters '12345'.
$check2 = strstr($string, '|');
stop echoing when the character '|' is found.
How would I do something like that?
I've been at it for days, feeling stupid, because I can't find it! I've come close, it does the first half of the script above;
PHP Code:
$reviewID = $_GET["reviewID"]; //Set the variable 'reviewID' as from the URL.
$string = file_get_contents("ffdatabase.txt");
$strings = explode('|',$string);
$find = strstr($string, $reviewID);
echo $find;
That finds the '$reviewID' in the database, then echoes everything up from that, stopping at the end of the file. I want it to stop echoing as soon as it hits a delimiter.
Thanks,
-PG