158k views
0 votes
Which of the following instructions will write the contents of the variable $name to the file referenced by $someFile?

fgets($someFile, $name);

list($someFile, $name);

fopen($someFile, $name);

fputs($someFile, $name);

User Askheaves
by
6.4k points

1 Answer

6 votes

Answer:

D. fputs($someFile, $name);

Step-by-step explanation:

The instruction is not right as it is in the answer, because the content inside $name will be placed into the file referenced by $someFile. The correct structure is like this:

fputs($name, $someFile);

where:

  • $name is the variable with the content to be inserted.
  • $someFile is the file where the information is going to be saved.

User Johnny Kauffman
by
6.3k points