Log in

View Full Version : line read



enetsorber
02-13-2008, 11:28 AM
hi,

i need a php code that reads the first line of a file "test.txt".
and checks if it is equal to ="hello".
can any body help!

midhul
02-13-2008, 11:32 AM
This code can be used!


<?php

$lns = file('test.txt');
$ln = count($lns);
for($x = 0; $x< $ln; $x++)
{
}

if($lns[0]=='hello')
{
echo "correct";
}

else
{
echo "wrong";
}


?>







?>

enetsorber
02-13-2008, 11:33 AM
hey awsome is working!

Thanks alot!