Ask Your Question
1

What is the deprecation message for the usort() function regarding returning a boolean from the comparison function, and what should be returned instead?

asked 2023-05-18 00:40:46 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-05-18 00:47:01 +0000

lalupa gravatar image

The deprecation message for the usort() function regarding returning a boolean from the comparison function is "Returning bool values from comparison functions is deprecated. Return an integer less than, equal to, or greater than zero". Instead of returning a boolean, the comparison function should return an integer, either less than, equal to, or greater than zero, indicating the order of the two elements being compared.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-18 00:40:46 +0000

Seen: 7 times

Last updated: May 18 '23