You are here: Re: Advantages of using classes over functions? « PHP Programming Language « IT news, forums, messages
Re: Advantages of using classes over functions?

Posted by Chuck Anderson on 05/10/05 03:56

bissatch@yahoo.co.uk wrote:

>Hi,
>
>Generally if I re-use code, I use a function. If I need to use these
>functions over a number of pages I write the function to an include
>file where all pages have access.
>
>So when should I ever use PHP classes instead. I have learned how to
>put together PHP classes but never seen a reason to use them where I
>can simply use a function.
>
>Im basically just wanting to know classes benefits over functions. If
>something can be better put together in a class I would like to be
>doing it that way. Any suggestions?
>
>Cheers
>
>Burnsy
>
>
>
This brings up a question I have (hope it's okay to divert the topic
slightly). Should I write a common piece of code as a callable function,
or should I just make it some script that I can include (seems like it
would save the function call). If I write a function, I have to include
the file where I keep the function, anyway. So I tend to simply include
the "function" inline and then document the include file with pseudo
inputs and outputs (what vars does it depend on and what vars does it
change).

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация