+ 1
Why PHP outputs "Resource id #3 " ??
<?PHP $myfile=fopen("solo.txt","w"); $txt="Shahabuddin\n"; fwrite($myfile,$txt); echo $myfile; ?> //Output: Resource id #3
2 ответов
+ 3
Because you get a resource pointer in return and not the actual content by using echo $myfile;
Read the file and print its contents instead:
<?php
$myfile=fopen("solo.txt","w");
$txt="Shahabuddin\n";
fwrite($myfile,$txt);
$read = file('solo.txt');
foreach ($read as $line) {
echo $line ."";
}
?>
0
Thank you mr dev. Let me try again :)