Zend
200-710 · Question #1
What is the difference between the spaceship operator (<=>) and the strcmp() function?
The correct answer is D. The spaceship operator returns -1, 0 or 1; strcmp() may return any integer. See the full explanation below for the reasoning.
Strings & Patterns
Question
What is the difference between the spaceship operator (<=>) and the strcmp() function?
Options
- AThere is no difference in functionality
- Bstrcmp() returns a Boolean value, the spaceship operator a number
- Cstrcmp() does a case-intensive comparison, the spaceship operator does not
- DThe spaceship operator returns -1, 0 or 1; strcmp() may return any integer
How the community answered
(40 responses)- A8% (3)
- B3% (1)
- C10% (4)
- D80% (32)
Topics
#spaceship operator#strcmp#string comparison#return values
Community Discussion
No community discussion yet for this question.