Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Zend Exam 200-710 Topic 2 Question 37 Discussion

Actual exam question for Zend's 200-710 exam
Question #: 37
Topic #: 2
[All 200-710 Questions]

Given a PHP value, which sample shows how to convert the value to JSON?

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

Rickie
23 days ago
I wonder if option D involves turning the value into a Transformer first, and then converting it to JSON. Probably best to keep it simple with json_encode().
upvoted 0 times
Viola
2 days ago
A) $string = json_encode($value);
upvoted 0 times
...
...
Trina
26 days ago
If I see 'Json' with a capital 'J', I automatically assume it's not the standard PHP function. json_encode() all the way!
upvoted 0 times
...
Lynda
1 months ago
Converting the value to an object and then calling a custom __toJson() method? That's just weird. json_encode() is the way to go.
upvoted 0 times
Delbert
8 days ago
Yeah, json_encode() is the standard way to convert PHP values to JSON.
upvoted 0 times
...
Laurel
8 days ago
B) $string = Json::encode($value);
upvoted 0 times
...
Lili
15 days ago
A) $string = json_encode($value);
upvoted 0 times
...
Brynn
16 days ago
Yeah, json_encode() is definitely the way to go.
upvoted 0 times
...
Ashlee
18 days ago
A) $string = json_encode($value);
upvoted 0 times
...
...
Natalie
1 months ago
Creating a new Json object and then converting it to a string? That seems overly complicated. I'll stick with the simple json_encode() method.
upvoted 0 times
Angella
1 days ago
A) $string = json_encode($value);
upvoted 0 times
...
Kristeen
7 days ago
I agree, json_encode() is much simpler.
upvoted 0 times
...
Simona
18 days ago
A) $string = json_encode($value);
upvoted 0 times
...
...
Brice
2 months ago
Option B looks like it might be a custom function, but I'm not familiar with it. I'll go with the built-in json_encode() function.
upvoted 0 times
Whitley
29 days ago
Yeah, json_encode() is a built-in function for converting PHP values to JSON.
upvoted 0 times
...
Clarinda
1 months ago
I agree, json_encode() is the way to go.
upvoted 0 times
...
...
Dylan
2 months ago
The correct answer is A. json_encode() is the standard PHP function to convert a value to JSON.
upvoted 0 times
Adrianna
1 days ago
Yes, that's correct. json_encode() is the way to go.
upvoted 0 times
...
Nichelle
21 days ago
A) $string = json_encode($value);
upvoted 0 times
...
...
Kattie
2 months ago
I'm not sure, but I think B) $string = Json::encode($value); could also be a valid option.
upvoted 0 times
...
Chan
2 months ago
I agree with Tonette, json_encode is the right function to convert PHP value to JSON.
upvoted 0 times
...
Tonette
2 months ago
I think the correct answer is A) $string = json_encode($value);
upvoted 0 times
...

Save Cancel