I have been using the fgetcsv() function before to detect a character while opening and reading a file. Now, I need to look for not just one character, but for a string (like for example "<table>" or "<table width=\"100\"> or any string within the file.
How can I do that?
The code I was using before is
Code: Select all
<?php
foreach($pages as $file){
$fp = fopen ("$file", 'rb');
while ($line = fgetcsv ($fp, 200, "n")) {
foreach('n') {
echo "one n found";
break;
}
}
fclose ($fp);
}
?>Code: Select all
<?php
foreach($pages as $file){
$fp = fopen ("$file", 'rb');
while ($line = fgetcsv ($fp, 200, "<table>")) {
foreach('<table>') {
echo "one table tag found";
break;
}
}
fclose ($fp);
}
?>Thanks for your help!