Re: [PHP4BETA] propose for bool -> string conversion:

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: [PHP4BETA] propose for bool -> string conversion:
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-1820@lists.php.net to get a copy of this message
> > It's not the most consistent thing in the world, but having it > > return 1, for example, would also suck because then you would > > have to fudge the return value when you wanted to use it > > directly as a string index. ie. > > > > $string[strpos($a,"a")]; > > That's a broken script. It's as silly as > > fpassthru(fread($somefile, "r")); > > because they both depend on the success of the inner function > which cannot be guaranteed always. If the user does some kind of > check, so that the inner function is guaranteed to succeed, we can > also return -1 or whatever. Sometimes you don't care if they fail. What exactly are you proposing for the strpos() function? Are you really saying that a char found at index 0 should not make it return 0? Or are you proposing that we don't return false when the char isn't found and return -1 instead? The latter option is how it used to be in PHP2. -Rasmus

« previous php.version4 (#1820) next »