Chris S
Retired
- Messages
- 2,055
- Reaction score
- 1
- Points
- 38
I am working on something to help me find out if a song is explicative or not. I have the following code
the only issue is that its not returning the fact that the word is found. I am currently searching for the word 'both' (w/o the quotes) in the string:
as you can see, the word 'both' appears in the string I am searching.
Any solutions, I have one, but I don't really want to do it as it involves another loop
Code:
if($i == 1 || $i == 2){
$preLyrics = openLink($link);
$lyrics = explode("Lyrics -->",$preLyrics);
print_r($words);
$length = count($words);
for($x = 0;$x < $length; $x++){
if(stristr($lyrics[1], $words[$x]) === TRUE){
$found = true;
break;
}
}
if(!$found){
echo '<pre>';
print_r($lyrics[1]);
echo '</pre>';
}
}
the only issue is that its not returning the fact that the word is found. I am currently searching for the word 'both' (w/o the quotes) in the string:
Good morning, son
In twenty years from now
Maybe we'll both sit down and have a few beers
And I can tell you 'bout today
And how I picked you up and everything changed
It was pain
Sunny days and rain
I knew you'd feel the same things
as you can see, the word 'both' appears in the string I am searching.
Any solutions, I have one, but I don't really want to do it as it involves another loop