nerdexam
Zend

200-530 · Question #357550

Which of the following code snippets writes the content of the "source.txt" to "target.txt"?

The correct answer is A. file_put_contents("target.txt", fopen("source.txt", "r")); D. file_put_contents("target.txt", file_get_contents("source.txt")); E. $handle = fopen("target.txt", "w+"); fwrite($handle, file_get_contents("source.txt")); fclose($handle). See the full explanation below for the reasoning.

Question

Which of the following code snippets writes the content of the "source.txt" to "target.txt"?

Options

  • Afile_put_contents("target.txt", fopen("source.txt", "r"));
  • Bfile_put_contents("target.txt", readfile("source.txt"));
  • Cfile_put_contents("target.txt", join(file("source.txt"), ""));
  • Dfile_put_contents("target.txt", file_get_contents("source.txt"));
  • E$handle = fopen("target.txt", "w+"); fwrite($handle, file_get_contents("source.txt")); fclose($handle);

How the community answered

(21 responses)
  • A
    76% (16)
  • B
    14% (3)
  • C
    10% (2)

Community Discussion

No community discussion yet for this question.

Full 200-530 Practice