Zend
200-550 · Question #216
Given a PHP value, which sample shows how to convert the value to JSON?
The correct answer is A. $string = json_encode($value). See the full explanation below for the reasoning.
Question
Given a PHP value, which sample shows how to convert the value to JSON?
Options
- A$string = json_encode($value);
- B$string = Json::encode($value);
- C$json = new Json($value); $string = $json->__toString();
- D$value = (object) $value; $string = $value->__toJson();
How the community answered
(36 responses)- A75% (27)
- B8% (3)
- C14% (5)
- D3% (1)
Community Discussion
No community discussion yet for this question.