nerdexam
Zend

200-550 · Question #5

Which of the following code snippets DO NOT write the exact content of the file "source.txt" to "target.txt"? (Choose 2)

The correct answer is B. file_put_contents("target.txt", readfile("source.txt")); C. file_put_contents("target.txt", join(file("source.txt"), "\n")). See the full explanation below for the reasoning.

Question

Which of the following code snippets DO NOT write the exact content of the file "source.txt" to "target.txt"? (Choose 2)

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"), "\n"));
  • Dfile_put_contents("target.txt", file_get_contents("source.txt"));
  • E$handle = fopen("target.txt", "w+"); fwrite($handle, file_get_contents("source.txt"));

How the community answered

(33 responses)
  • A
    3% (1)
  • B
    76% (25)
  • D
    6% (2)
  • E
    15% (5)

Community Discussion

No community discussion yet for this question.

Full 200-550 Practice