Page 3 of 3

Re: String Function

Posted: Mon Jun 16, 2008 7:00 am
by hansford
actually mine needs a break; for when the string is found. DevNets is cleaner, less code.

Code: Select all

 
<?php
 
$haystack = file_get_contents("logs2.txt");
$hayarray = explode("\n", $haystack);
$needle = file_get_contents("files2.txt");
$needarray = explode("\n", $needle);
 
foreach($hayarray as $arg){
 
foreach($needarray as $val){
 
if(strpos($arg, $val) !== false) {
 
    echo "found: " . $val . "<br>";
    break;
}
}
}
?>