Re: Re: return int or bool?

From: Date: Sun, 10 Nov 2002 01:46:16 +0000
Subject: Re: Re: return int or bool?
References: 1 2 3  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969349526@lists.php.net to get a copy of this message
It would be a very nice idea, but a big work. Would you do it? :-) -- M.CHAILLAN Nicolas nicos@php.net www.WorldAKT.com Hébergement de sites internets. "Maxim Maletsky" <maxim@php.net> a écrit dans le message de news: 20021110023333.7BF4.MAXIM@php.net... such functions are really many. Shall we split the efforts? Make a list also for the translations to be consistent? -- Maxim Maletsky maxim@php.net On Sun, 10 Nov 2002 02:30:18 +0100 <nicos@php.net> wrote: > Yes its probably cause of that. But this should be now changed to bool. > > -- > > M.CHAILLAN Nicolas > nicos@php.net > www.WorldAKT.com Hébergement de sites internets. > > "Maxim Maletsky" <maxim@php.net> a écrit dans le message de news: > 20021110021932.7BF1.MAXIM@php.net... > > I guess it is because before true and false used to be ones and zeros. > So, ints were actually returned. Tell me i am wrong... > > -- > Maxim Maletsky > maxim@php.net > > > On Sun, 10 Nov 2002 02:12:26 +0100 <nicos@php.net> wrote: > > > Yes it should be corrected. This is a bad proto information. > > > > -- > > > > M.CHAILLAN Nicolas > > nicos@php.net > > www.WorldAKT.com Hébergement de sites internets. > > > > "Maxim Maletsky" <maxim@php.net> a écrit dans le message de news: > > 20021110014721.7BEE.MAXIM@php.net... > > > > > > Guys, I've been wondering about the returns specified for function > > > protos. > > > > > > Many functions (as OCICommit() or copy() or even phpinfo() for instance) > > > do an action and return you the result relevant to their success as the > > > boolean type. However, these functions are documented as: > > > > > > int OCICommit ( int connection) > > > int copy ( string source, string dest) > > > > > > in other words, they say the return is an integer. That is a very > > > confusing thing IMO. Especially because functions like is_dir() or > > > file_exists() show it right: > > > > > > bool is_dir ( string filename) > > > bool file_exists ( string filename) > > > > > > true, one doing: > > > > > > if(OCICommit($conn)) > > > echo 'ok'; > > > else > > > echo 'doh'; > > > > > > will still get the desired result, but if one tries to compare it to > > > zeros and ones will fail.. in fact, even a simple: > > > > > > if(phpinfo() === 1) > > > echo "result is integer 1"; > > > > > > will fail because even phpinfo() returns boolean, not integer... ( == 1 > > > will work though because of the runtime typecasting...) > > > > > > I cannot see the reason why so many functions should still claim to > return > > integers > > > while they in fact return booleans. It is so confusing, IMO. > > > > > > Shouldn't we correct them? There are way more than only these two > > > functions I used as examples. > > > > > > -- > > > Maxim Maletsky > > > maxim@php.net > > > > > > > > > > > -- > > PHP Documentation Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > PHP Documentation Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.doc (#969349526) next »