[thelist] Global variables in functions?

Ralph Guzman ralph213 at sbcglobal.net
Wed Aug 20 04:54:31 CDT 2003


Kelly

You're right. In this case, it does not make a difference if you used
echo or return. But it would if you wanted to return multiple values. 

It is better programming practice to not echo/print inside a function,
always return the data whether it be string, boolean, array. This way
you can later determine when (and if) it should be displayed and how.

Else, you'll find yourself re-writing functions because you need it to
return data instead of displaying it. Of course there will be times when
it's necessary to break this rule, but personally except for when I'm
debugging code, I can't remember the last time I had to break the rule.

On a different note, I checked out your web site. I like your style and
you have some great artwork. You do freelance work? I'm looking for
extra help on graphics and even programming (php/mysql). Contact me off
the list if you are available.

I am also located in Los Angeles, Glendale to be exact. Most of the
people that I've been working with are in other cities, states, and even
other countries. So it would be ideal to find somebody who is local.

Let me know,

Ralph Guzman
EM: ralph213<AT>sbcblobal.net

>Isn't that pretty reflexive?  Looks like a wrapper for echo.
>I see that you ammended your post saying that it should return $output 
>instead of using echo.  However, I still fail to see how it's much 
>different than if ($o) { echo $o; }, unless other code was added...

-- 
Kelly Hallman
http://wrack.org/


-- 
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 




More information about the thelist mailing list