nerdexam
Zend

200-530 · Question #162

You want to extract the pieces of a date string, which looks like this: "2005-11-02". Which of the following pieces of code will properly assign $year, $month and $day with their respective values?

The correct answer is A. sscanf("2005-11-02", '%d-%d-%d', $year, $month, $day). See the full explanation below for the reasoning.

Question

You want to extract the pieces of a date string, which looks like this: "2005-11-02". Which of the following pieces of code will properly assign $year, $month and $day with their respective values?

Options

  • Asscanf("2005-11-02", '%d-%d-%d', $year, $month, $day);
  • Bscan("2005-11-02", '%d-%d-%d', $year, $month, $day);
  • Csscanf('%d-%d-%d', "2005-11-02", $year, $month, $day);
  • Dsscan($year, $month, $date '%d-%d-%d', "2005-11-02");

How the community answered

(17 responses)
  • A
    82% (14)
  • B
    6% (1)
  • D
    12% (2)

Community Discussion

No community discussion yet for this question.

Full 200-530 Practice