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 55 Discussion

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

What is the output of the following code?

var_dump(boolval(new StdClass()));

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Sabrina
13 days ago
I bet the correct answer is bool(false). StdClass is so standard, it's gotta be false, right?
upvoted 0 times
...
Barabara
15 days ago
Seriously, who writes code like this? It's like they're trying to trick us!
upvoted 0 times
...
Kami
18 days ago
I'm going to go with bool(false) on this one. Can't fool me, PHP!
upvoted 0 times
...
Leanna
27 days ago
Wait, what? I thought boolval() would return false for an empty object. This is trickier than it looks.
upvoted 0 times
...
Shakira
2 months ago
Easy peasy! It's got to be bool(true). Everything is truthy in PHP, even an empty object!
upvoted 0 times
Malinda
15 days ago
Exactly! PHP treats everything as truthy, even an empty object.
upvoted 0 times
...
Bulah
21 days ago
bool(true)
upvoted 0 times
...
Rodolfo
23 days ago
Exactly! PHP treats an empty object as true.
upvoted 0 times
...
Linwood
26 days ago
bool(true)
upvoted 0 times
...
...
Judy
2 months ago
A) bool(true)
upvoted 0 times
...
Chauncey
2 months ago
Hmm, I'm thinking it's going to be bool(false). After all, a new StdClass object is an empty object, right?
upvoted 0 times
Alfred
15 days ago
Yes, boolval() returns true for any non-empty object.
upvoted 0 times
...
Luis
1 months ago
Oh really? I thought it would be bool(false).
upvoted 0 times
...
Herminia
1 months ago
Actually, the output is bool(true).
upvoted 0 times
...
Johanna
1 months ago
A) bool(true)
upvoted 0 times
...
...
Domitila
2 months ago
B) bool(false)
upvoted 0 times
...
Mary
2 months ago
A) bool(true)
upvoted 0 times
...

Save Cancel