Friday, 3 June 2016

Questions: File functions

What is the output of following code?
<?php
$name = 'fpassthru.txt';

$str = <<<EOF
FOO
BAR
BAZ
EOF;

$fp = fopen($name, 'w');
fwrite($fp, $str);
fclose($fp);

$fp = fopen($name, 'r');
fgets($fp);
fpassthru($fp);
fclose($fp);
?>

a) FOO BAR
b) BAR BAZ
c) FOO BAZ
d) BAR FOO

No comments:

Post a Comment