[thelist] [PHP] Anyway of Implementing CFC-like code in PHP?
Simon Willison
cs1spw at bath.ac.uk
Sat Oct 18 18:51:31 CDT 2003
Chris Johnston wrote:
> I am just starting out learning php and have a small question. In CFMX,
> it possible to create object like code in the form of CFC's. This allows
> you to separate logic from design. It is an amazing way of coding and
> allows for a lot of versatility in the way web applications are put
> together.
>
> What I am wondering is this: is there any way of duplicating this
> functionality in php? Or is php code intrinsically composed of inline
> code designed specifically for a particular page?
This is very possible using PHP. From what I've seen of CFCs they are
similar to the concept of a class in object oriented languages. PHP has
a fair amount of support for object orientation (with better support on
the way in PHP 5) and allows you to define classes. PHP's include() and
require() statements allow you to include code from other scripts. Hence
you can define classes in files and then use them in a number of
different scripts on your site.
Hope that answers your question,
Simon Willison
http://simon.incutio.com/
More information about the thelist
mailing list