ik heb een logfile die ik wil uitlezen het is plain text
ik heb al een 2 demensionale array gemaakt van het file.
de eerste array bevat alle lines van het file, de 2e bevat alle woorden per line.
hier is een stuk code waar het om gaat: $line is de 2 demensionale array
<?php
$filename = "logfiles/dg-px01.acl";
$fh = fopen($filename,"rb");
$num = 0;
while(!feof($fh))
{
$line[$num] = fgets($fh);
if( $line[$num] == null ) break;
$expl = explode(" ",$line[$num]);
for($i=0; $i < count($expl); $i++)
{
$line[$num] = ($expl);
}
$num++;
unset($expl);
}
for( $i=0; $i < count($line); $i++ )
{
for( $j=0; $j < count($line[$i]); $j++)
{
echo $line[$i][$j];
}
echo "<BR />";
}
function readacl($aclname, $line )
{
$j = 0;
for( $i=0; $i < count($line); $i++ )
{
if( in_array ( $aclname, $line[$i] ) )
{
$acloutput[$j] = implode(" ", $line[$i]);
$j++;
}
}
return $acloutput;
}
$test = array(readacl("outbound", $line));
echo $test;
#for( $i=0; $i < count($test); $i++)
#{
# echo $test[$i];
#}
?>
waar het nu fout gaat is dat ik op een of andere manier readacl niet in $test krijg. error die ik krijg:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/www/html/test/readacl.php on line 32
Notice: Undefined variable: acloutput in /var/www/html/test/readacl.php on line 38
Array
knop om dit te doen.