Deal of The Day! Hurry Up, Grab the Special Discount - Save 25%
- Ends In
00:00:00
Coupon code:
SAVE25
X
Welcome to Pass4Success
Login
|
Sign up
-
Free
Preparation Discussions
Mail Us
support@pass4success.com
Location
US
MENU
Home
Popular vendors
Salesforce
Microsoft
Nutanix
Amazon
Google
CompTIA
SAP
VMware
Fortinet
PeopleCert
Eccouncil
HP
Palo Alto Networks
Adobe
ServiceNow
Dell EMC
CheckPoint
Linux Foundation
Discount Deals
New
About
Contact
Login
Sign up
Home
Discussions
Zend Discussions
Exam 200-710 Topic 2 Question 37 Discussion
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?
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();
Show Suggested Answer
Hide Answer
Suggested Answer:
B
by
Tiera
at
Oct 14, 2022, 11:17 AM
Limited Time Offer
25%
Off
Get Premium 200-710 Questions as Interactive Web-Based Practice Test or PDF
Contribute your Thoughts:
Submit
Cancel
Rickie
2 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 months ago
B) $string = Json::encode($value);
upvoted
0
times
...
Therese
1 months ago
Yes, that's the correct way to convert a PHP value to JSON.
upvoted
0
times
...
Viola
2 months ago
A) $string = json_encode($value);
upvoted
0
times
...
...
Trina
2 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
3 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
1 months ago
B) $string = Json::encode($value);
upvoted
0
times
...
Delbert
2 months ago
Yeah, json_encode() is the standard way to convert PHP values to JSON.
upvoted
0
times
...
Laurel
2 months ago
B) $string = Json::encode($value);
upvoted
0
times
...
Lili
2 months ago
A) $string = json_encode($value);
upvoted
0
times
...
Brynn
2 months ago
Yeah, json_encode() is definitely the way to go.
upvoted
0
times
...
Ashlee
2 months ago
A) $string = json_encode($value);
upvoted
0
times
...
...
Natalie
3 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 months ago
B) $string = Json::encode($value);
upvoted
0
times
...
Wilda
1 months ago
A) $string = json_encode($value);
upvoted
0
times
...
Berry
1 months ago
B) $string = Json::encode($value);
upvoted
0
times
...
Angella
2 months ago
A) $string = json_encode($value);
upvoted
0
times
...
Kristeen
2 months ago
I agree, json_encode() is much simpler.
upvoted
0
times
...
Simona
2 months ago
A) $string = json_encode($value);
upvoted
0
times
...
...
Brice
3 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
3 months ago
Yeah, json_encode() is a built-in function for converting PHP values to JSON.
upvoted
0
times
...
Clarinda
3 months ago
I agree, json_encode() is the way to go.
upvoted
0
times
...
...
Dylan
3 months ago
The correct answer is A. json_encode() is the standard PHP function to convert a value to JSON.
upvoted
0
times
Adrianna
2 months ago
Yes, that's correct. json_encode() is the way to go.
upvoted
0
times
...
Nichelle
2 months ago
A) $string = json_encode($value);
upvoted
0
times
...
...
Kattie
4 months ago
I'm not sure, but I think B) $string = Json::encode($value); could also be a valid option.
upvoted
0
times
...
Chan
4 months ago
I agree with Tonette, json_encode is the right function to convert PHP value to JSON.
upvoted
0
times
...
Tonette
4 months ago
I think the correct answer is A) $string = json_encode($value);
upvoted
0
times
...
Log in to Pass4Success
×
Sign in:
Forgot my password
Log in
Report Comment
×
Is the comment made by
USERNAME
spam or abusive?
Commenting
×
In order to participate in the comments you need to be logged-in.
You can
sign-up
or
login
Save
Cancel
Rickie
2 months agoArlene
1 months agoTherese
1 months agoViola
2 months agoTrina
2 months agoLynda
3 months agoJeannetta
1 months agoDelbert
2 months agoLaurel
2 months agoLili
2 months agoBrynn
2 months agoAshlee
2 months agoNatalie
3 months agoLouisa
1 months agoWilda
1 months agoBerry
1 months agoAngella
2 months agoKristeen
2 months agoSimona
2 months agoBrice
3 months agoWhitley
3 months agoClarinda
3 months agoDylan
3 months agoAdrianna
2 months agoNichelle
2 months agoKattie
4 months agoChan
4 months agoTonette
4 months ago