List Info

Thread: note 68501 added to function.mysql-fetch-assoc




note 68501 added to function.mysql-fetch-assoc
user name
2006-07-30 09:42:09
I read someone posting 'I have the philosphy that a
function has exactly one return point.'

It seems to me that always having only one return point
takes away a little power from 'return' making code less
efficient. Compare:

function doSomething($a,$b) {
   $returnVal = 1;
   if($a==$b) { $returnVal = false; }
   if($returnVal !== false) { //didnt we discover that
already?
      //do something as we know a and b is what we expect
      $returnVal = $a - $b;
   }
   return $returnVal;
}

with:

function doSomething($a,$b) {
   if($a==$b) { return false; //early exit }
   //do something as we know a and b is what we expect
   return $a-$b;
}
----
Server IP: 194.109.193.119
Probable Submitter: 84.82.64.236
----
X-Spam-Status: No, hits=3.1 required=5.0
tests=DATE_MISSING,FROM_NO_LOWER 
	autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-ass
oc.php
Edit        -- http://master.p
hp.net/note/edit/68501
Del: integrated  -- ht
tp://master.php.net/note/delete/68501/integrated
Del: useless     -- http:
//master.php.net/note/delete/68501/useless
Del: bad code    -- http
://master.php.net/note/delete/68501/bad+code
Del: spam        -- http://m
aster.php.net/note/delete/68501/spam
Del: non-english -- h
ttp://master.php.net/note/delete/68501/non-english
Del: in docs     -- http:
//master.php.net/note/delete/68501/in+docs
Del: other reasons-- http://master
.php.net/note/delete/68501
Reject      -- http://master
.php.net/note/reject/68501
Search      -- http://ma
ster.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )