Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer
- Ends In
00:00:00
Coupon code:
SAVE25
X
Welcome to Pass4Success
Login
|
Sign up
-
Free
Preparation Discussions
Mail Us
support@pass4success.com
Location
PL
MENU
Home
Popular vendors
Salesforce
Microsoft
Nutanix
Cisco
Amazon
Google
CompTIA
SAP
VMware
Oracle
Fortinet
PeopleCert
Eccouncil
HP
Palo Alto Networks
Adobe
ISC2
ServiceNow
Dell EMC
CheckPoint
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
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
...
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
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
Rickie
1 months agoArlene
1 days agoTherese
4 days agoViola
17 days agoTrina
1 months agoLynda
2 months agoJeannetta
7 days agoDelbert
23 days agoLaurel
23 days agoLili
1 months agoBrynn
1 months agoAshlee
1 months agoNatalie
2 months agoLouisa
1 days agoWilda
5 days agoBerry
11 days agoAngella
16 days agoKristeen
22 days agoSimona
1 months agoBrice
2 months agoWhitley
1 months agoClarinda
2 months agoDylan
2 months agoAdrianna
16 days agoNichelle
1 months agoKattie
3 months agoChan
3 months agoTonette
3 months ago