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
[EMAIL PROTECTED]
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php