Posted by J.O. Aho on 12/04/07 05:34
Darrell wrote:
> I wrote that snippet just to see what the output was from array_keys because
> nothing was working as expected.
> What I was aiming for is an array with all of the keys for <HR> in a text
> file
> in order to trim the file to the last X number of occurrences of <HR>.
> Darrell
This should do the thing you thought about:
$Buf = file("bsshort2.txt");
foreach($Buf AS $key => $value) {
if(!(stristr($value, '<HR>') === FALSE)) {
$hrkeys[]=$key;
}
}
--
//Aho
Navigation:
[Reply to this message]
|