Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
i've heard that a function is always supposed to return something or else it's technically a subroutine.
what if i'm using a function in a class (a method) and it's just setting a member variable and not
really returning anything, am i supposed to
or should I return that member
variable? it seems redundant to return a variable that can be used throughout the class once the function
has been called.
i would say it does not really matter; if you want to return, return something else do not return.
eventhough technically one which returns is a function and which does not is a subroutine; it also depends on how programming languages consider it.
but it is important to return proper values
1. like making decisions: return TRUE or FALSE
2. if object, result set or some value is epcted: return value if available else return NULL
but there is no point in keep returning NULL if return is not expected by calling function.