I am trying to read a.php file from another PHP file using fgets() and
display its contents. As a.php starts with <? the browser IE6 does not show
anything, although I can see all the contents in View-Source.
I tried to skip the line with <? using the following code:
@ $fp=fopen("a.ph p","r");
while (!feof($fp))
{
$line=fgets($fp );
if (!$line=="<?")
{
echo $line;
}
else
{
echo "w";
}
However it keeps outputting "w" for every line of a.php.
This does not change even is I reverse the condition to if (!$line=="<?")
as if whatever is returened by fgets($fp) cannot be compared to "<?".
I tried to add the end of the line to the pattern (!$line=="<?\n" ) or
($line=="<?\n") - same result.
What is that I am doing wrong?
display its contents. As a.php starts with <? the browser IE6 does not show
anything, although I can see all the contents in View-Source.
I tried to skip the line with <? using the following code:
@ $fp=fopen("a.ph p","r");
while (!feof($fp))
{
$line=fgets($fp );
if (!$line=="<?")
{
echo $line;
}
else
{
echo "w";
}
However it keeps outputting "w" for every line of a.php.
This does not change even is I reverse the condition to if (!$line=="<?")
as if whatever is returened by fgets($fp) cannot be compared to "<?".
I tried to add the end of the line to the pattern (!$line=="<?\n" ) or
($line=="<?\n") - same result.
What is that I am doing wrong?
Comment