Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - 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
1 months 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
Arlene
1 days ago
B) $string = Json::encode($value);
upvoted 0 times
...
Therese
4 days ago
Yes, that's the correct way to convert a PHP value to JSON.
upvoted 0 times
...
Viola
17 days ago
A) $string = json_encode($value);
upvoted 0 times
...
...
Trina
1 months 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
2 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
Jeannetta
7 days ago
B) $string = Json::encode($value);
upvoted 0 times
...
Delbert
23 days ago
Yeah, json_encode() is the standard way to convert PHP values to JSON.
upvoted 0 times
...
Laurel
23 days ago
B) $string = Json::encode($value);
upvoted 0 times
...
Lili
1 months ago
A) $string = json_encode($value);
upvoted 0 times
...
Brynn
1 months ago
Yeah, json_encode() is definitely the way to go.
upvoted 0 times
...
Ashlee
1 months ago
A) $string = json_encode($value);
upvoted 0 times
...
...
Natalie
2 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
Louisa
1 days ago
B) $string = Json::encode($value);
upvoted 0 times
...
Wilda
5 days ago
A) $string = json_encode($value);
upvoted 0 times
...
Berry
11 days ago
B) $string = Json::encode($value);
upvoted 0 times
...
Angella
16 days ago
A) $string = json_encode($value);
upvoted 0 times
...
Kristeen
22 days ago
I agree, json_encode() is much simpler.
upvoted 0 times
...
Simona
1 months 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
1 months ago
Yeah, json_encode() is a built-in function for converting PHP values to JSON.
upvoted 0 times
...
Clarinda
2 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
16 days ago
Yes, that's correct. json_encode() is the way to go.
upvoted 0 times
...
Nichelle
1 months ago
A) $string = json_encode($value);
upvoted 0 times
...
...
Kattie
3 months ago
I'm not sure, but I think B) $string = Json::encode($value); could also be a valid option.
upvoted 0 times
...
Chan
3 months ago
I agree with Tonette, json_encode is the right function to convert PHP value to JSON.
upvoted 0 times
...
Tonette
3 months ago
I think the correct answer is A) $string = json_encode($value);
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77