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
28 days ago
I bet the correct answer is bool(false). StdClass is so standard, it's gotta be false, right?
upvoted 0 times
...
Barabara
1 months ago
Seriously, who writes code like this? It's like they're trying to trick us!
upvoted 0 times
...
Kami
1 months ago
I'm going to go with bool(false) on this one. Can't fool me, PHP!
upvoted 0 times
Delfina
4 days ago
User 3: The output is bool(true)
upvoted 0 times
...
Gracia
12 days ago
User 2: I'm going with bool(false)
upvoted 0 times
...
Wynell
15 days ago
User 1: I think it's bool(true)
upvoted 0 times
...
...
Leanna
1 months 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
1 months ago
Exactly! PHP treats everything as truthy, even an empty object.
upvoted 0 times
...
Bulah
1 months ago
bool(true)
upvoted 0 times
...
Rodolfo
1 months ago
Exactly! PHP treats an empty object as true.
upvoted 0 times
...
Linwood
1 months 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
1 months ago
Yes, boolval() returns true for any non-empty object.
upvoted 0 times
...
Luis
2 months ago
Oh really? I thought it would be bool(false).
upvoted 0 times
...
Herminia
2 months ago
Actually, the output is bool(true).
upvoted 0 times
...
Johanna
2 months ago
A) bool(true)
upvoted 0 times
...
...
Domitila
2 months ago
B) bool(false)
upvoted 0 times
...
Mary
3 months ago
A) bool(true)
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