Re: zend_compare & co
| From: | Andi Gutmans | Date: | Sat, 06 Oct 2001 08:27:28 +0000 |
| Subject: | Re: zend_compare & co | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-67419@lists.php.net to get a copy of this message | ||
At 01:40 AM 10/6/2001 +0200, jeroen@php.net wrote:
Can you trust on the compare functions to return either -1, 0 or 1? I don't think so... but since that assumption is made in various locations in PHP4, it maybe is true?I think Zend's internal compare functions where normalized a while ago.
Similar question for zend booleans, can you trust the lval to be either 0 or 1, or not?Yes, booleans should be 0 or 1. All of this doesn't meant here aren't bugs someplace :) However, I think in general if you want to write a robust function which relies on these things you're best off relying on the 0 being false and all the rest being true. Andi