Re: Return or not to return, that is the question

From: Date: Wed, 30 May 2007 12:42:04 +0000
Subject: Re: Return or not to return, that is the question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-255802@lists.php.net to get a copy of this message
Chris Boget wrote:
If there is no need to return a value then I don't do so. However, the function is going to process something, and surely you should check that the processing has succeeded or failed?
This is precisely the point I was going to make. Unless an argument is passed in by reference for manipulation within the function, I can't think of a reason why you wouldn't want to return a value; true or false at the very least. You call a function to perform, well, a function. I would think that you would want to know whether or not the process within the function was successful, yes? thnx, Chris
All depends on the function. function someFunc(){ $this->counter++; if($this->counter > 100) $this->counter = 0; } Something that simple wont need a return at all.

« previous php.general (#255802) next »